references() {
    let attributes = this.attributes();
    let embedded = [];

    return {
      [Symbol.iterator]() {
        return this
      },

      /**
       * @return {Object} item
       * @return {boolean} item.done
       * @return {Object} item.value
       */
      next() {
        for (let attribute of attributes) {
          var type = attribute.isCollection ? attribute.elementType : attribute.type;
          if(type.isEntity) {
            return {done: false, value: {path: [attribute.name]}};
          } else if(type.isEmbeddable) {
            for (let emItem of type.references()) {
              embedded.push({done: false, value: {path: [attribute.name].concat(emItem.path)}});
            }
          }
        }

        return embedded.length ? embedded.pop() : {done: true};
      }
    }
  }
/**
   * Returns iterator to get all referenced entities
   * @return {Iterator<EntityType>}
   */
Returns iterator to get all referenced entities
@return {Iterator}
Returns iterator to get all referenced entities @return { Iterator }
references() {
    let attributes = this.attributes();
    let embedded = [];
    return {
      [Symbol.iterator]() {
        return this
      },
      next() {
        for (let attribute of attributes) {
          var type = attribute.isCollection ? attribute.elementType : attribute.type;
          if(type.isEntity) {
            return {done: false, value: {path: [attribute.name]}};
          } else if(type.isEmbeddable) {
            for (let emItem of type.references()) {
              embedded.push({done: false, value: {path: [attribute.name].concat(emItem.path)}});
            }
          }
        }
        return embedded.length ? embedded.pop() : {done: true};
      }
    }
  }
references ( ) { let attributes = this . attributes ( ) ; let embedded = [ ] ; return { [ Symbol . iterator ] ( ) { return this } , next ( ) { for ( let attribute of attributes ) { var type = attribute . isCollection ? attribute . elementType : attribute . type ; if ( type . isEntity ) { return { done : false , value : { path : [ attribute . name ] } } ; } else if ( type . isEmbeddable ) { for ( let emItem of type . references ( ) ) { embedded . push ( { done : false , value : { path : [ attribute . name ] . concat ( emItem . path ) } } ) ; } } } return embedded . length ? embedded . pop ( ) : { done : true } ; } } }
Returns iterator to get all referenced entities
 @return {Iterator<EntityType>}
Returns iterator to get all referenced entities @return { Iterator<EntityType > }
/**
       * @return {Object} item
       * @return {boolean} item.done
       * @return {Object} item.value
       */