protected function hydrate(array $data, QueryBuilder $qb)
    {
        $entity = $this->getEntityBuilder()->getEntity();

        $data = new ArrayObject($data);
        $preEventArgs = new HydrationEvent($data, ['entity' => $entity, 'repository' => $this]);
        $this->event()->dispatch(StorageEvents::PRE_HYDRATE, $preEventArgs);

        $this->getEntityBuilder()->createFromDatabaseValues($data, $entity);

        $postEventArgs = new HydrationEvent($entity, ['entity' => $entity, 'data' => $data, 'repository' => $this]);
        $this->event()->dispatch(StorageEvents::POST_HYDRATE, $postEventArgs);

        return $entity;
    }
protected function hydrate(array $data, QueryBuilder $qb)
    {
        $entity = $this->getEntityBuilder()->getEntity();

        $data = new ArrayObject($data);
        $preEventArgs = new HydrationEvent($data, ['entity' => $entity, 'repository' => $this]);
        $this->event()->dispatch(StorageEvents::PRE_HYDRATE, $preEventArgs);

        $this->getEntityBuilder()->createFromDatabaseValues($data, $entity);

        $postEventArgs = new HydrationEvent($entity, ['entity' => $entity, 'data' => $data, 'repository' => $this]);
        $this->event()->dispatch(StorageEvents::POST_HYDRATE, $postEventArgs);

        return $entity;
    }
protected function hydrate ( array $ data , QueryBuilder $ qb ) { $ entity = $ this -> getEntityBuilder ( ) -> getEntity ( ) ; $ data = new ArrayObject ( $ data ) ; $ preEventArgs = new HydrationEvent ( $ data , [ 'entity' => $ entity , 'repository' => $ this ] ) ; $ this -> event ( ) -> dispatch ( StorageEvents :: PRE_HYDRATE , $ preEventArgs ) ; $ this -> getEntityBuilder ( ) -> createFromDatabaseValues ( $ data , $ entity ) ; $ postEventArgs = new HydrationEvent ( $ entity , [ 'entity' => $ entity , 'data' => $ data , 'repository' => $ this ] ) ; $ this -> event ( ) -> dispatch ( StorageEvents :: POST_HYDRATE , $ postEventArgs ) ; return $ entity ; }
Internal method to hydrate an Entity Object from fetched data.

@param array        $data
@param QueryBuilder $qb

@return mixed
Internal method to hydrate an Entity Object from fetched data .