public function materialize(array $data, $entity)
    {
        //use a entity proxy to delay loading the related entity
        if ($this->_cardinality == 1) {
            $config = array();
            $config['relationship'] = $this;
            $config['value'] = $entity;
            $config['property'] = $this->_child_key;
            $config['service_identifier'] = $this->getChildRepository()->getDescription()->getEntityIdentifier();

            return new AnDomainEntityProxy(new AnConfig($config));
        } else {
            return $this->getSet($entity);
        }
    }
public function materialize(array $data, $entity)
    {
        //use a entity proxy to delay loading the related entity
        if ($this->_cardinality == 1) {
            $config = array();
            $config['relationship'] = $this;
            $config['value'] = $entity;
            $config['property'] = $this->_child_key;
            $config['service_identifier'] = $this->getChildRepository()->getDescription()->getEntityIdentifier();

            return new AnDomainEntityProxy(new AnConfig($config));
        } else {
            return $this->getSet($entity);
        }
    }
public function materialize ( array $ data , $ entity ) { //use a entity proxy to delay loading the related entity if ( $ this -> _cardinality == 1 ) { $ config = array ( ) ; $ config [ 'relationship' ] = $ this ; $ config [ 'value' ] = $ entity ; $ config [ 'property' ] = $ this -> _child_key ; $ config [ 'service_identifier' ] = $ this -> getChildRepository ( ) -> getDescription ( ) -> getEntityIdentifier ( ) ; return new AnDomainEntityProxy ( new AnConfig ( $ config ) ) ; } else { return $ this -> getSet ( $ entity ) ; } }
Materialize a relationship for the parent entity.

@param AnDomainAbstract $entity
@param array            $data

@return AnDomainCollectionAggregateAbstract
Materialize a relationship for the parent entity .