public function build(array $attributes)
    {
        // If the object we are building is a value object,
        // we won't be using the instance cache.
        if (!$this->useCache || $this->entityMap->getKeyName() === null) {
            return $this->buildEntity($attributes);
        }

        $instanceCache = $this->mapper->getInstanceCache();

        $id = $this->getPrimaryKeyValue($attributes);

        return $instanceCache->has($id) ? $instanceCache->get($id) : $this->buildEntity($attributes);
    }
public function build(array $attributes)
    {
        // If the object we are building is a value object,
        // we won't be using the instance cache.
        if (!$this->useCache || $this->entityMap->getKeyName() === null) {
            return $this->buildEntity($attributes);
        }

        $instanceCache = $this->mapper->getInstanceCache();

        $id = $this->getPrimaryKeyValue($attributes);

        return $instanceCache->has($id) ? $instanceCache->get($id) : $this->buildEntity($attributes);
    }
public function build ( array $ attributes ) { // If the object we are building is a value object, // we won't be using the instance cache. if ( ! $ this -> useCache || $ this -> entityMap -> getKeyName ( ) === null ) { return $ this -> buildEntity ( $ attributes ) ; } $ instanceCache = $ this -> mapper -> getInstanceCache ( ) ; $ id = $ this -> getPrimaryKeyValue ( $ attributes ) ; return $ instanceCache -> has ( $ id ) ? $ instanceCache -> get ( $ id ) : $ this -> buildEntity ( $ attributes ) ; }
Convert an array of attributes into an entity, or retrieve entity instance from cache.

@param array $attributes

@return mixed
Convert an array of attributes into an entity or retrieve entity instance from cache .