original_string: protected function _hydrateEntities(CollectionInterface $entities, array $args)
      {
          $values = $this->_prepareSetValues($entities, $args);
  
          return $entities->map(function ($entity) use ($values) {
              if ($entity instanceof EntityInterface) {
                  $entity = $this->_prepareCachedColumns($entity);
                  $entityId = $this->_toolbox->getEntityId($entity);
                  $entityValues = isset($values[$entityId]) ? $values[$entityId] : [];
                  $hydrator = $this->config('hydrator');
                  $entity = $hydrator($entity, $entityValues);
  
                  if ($entity === null) {
                      // mark as NULL_ENTITY
                      $entity = self::NULL_ENTITY;
                  }
              }
  
              return $entity;
          })
          ->filter(function ($entity) {
              // remove all entities marked as NULL_ENTITY
              return $entity !== self::NULL_ENTITY;
          });
      }
code: protected function _hydrateEntities(CollectionInterface $entities, array $args)
      {
          $values = $this->_prepareSetValues($entities, $args);
  
          return $entities->map(function ($entity) use ($values) {
              if ($entity instanceof EntityInterface) {
                  $entity = $this->_prepareCachedColumns($entity);
                  $entityId = $this->_toolbox->getEntityId($entity);
                  $entityValues = isset($values[$entityId]) ? $values[$entityId] : [];
                  $hydrator = $this->config('hydrator');
                  $entity = $hydrator($entity, $entityValues);
  
                  if ($entity === null) {
                      // mark as NULL_ENTITY
                      $entity = self::NULL_ENTITY;
                  }
              }
  
              return $entity;
          })
          ->filter(function ($entity) {
              // remove all entities marked as NULL_ENTITY
              return $entity !== self::NULL_ENTITY;
          });
      }
code_tokens: protected function _hydrateEntities ( CollectionInterface $ entities , array $ args ) { $ values = $ this -> _prepareSetValues ( $ entities , $ args ) ; return $ entities -> map ( function ( $ entity ) use ( $ values ) { if ( $ entity instanceof EntityInterface ) { $ entity = $ this -> _prepareCachedColumns ( $ entity ) ; $ entityId = $ this -> _toolbox -> getEntityId ( $ entity ) ; $ entityValues = isset ( $ values [ $ entityId ] ) ? $ values [ $ entityId ] : [ ] ; $ hydrator = $ this -> config ( 'hydrator' ) ; $ entity = $ hydrator ( $ entity , $ entityValues ) ; if ( $ entity === null ) { // mark as NULL_ENTITY $ entity = self :: NULL_ENTITY ; } } return $ entity ; } ) -> filter ( function ( $ entity ) { // remove all entities marked as NULL_ENTITY return $ entity !== self :: NULL_ENTITY ; } ) ; }
docstring: Attach EAV attributes for every entity in the provided result-set.
  
  This method iterates over each retrieved entity and invokes the
  `hydrateEntity()` method. This last should return the altered entity object
  with all its virtual properties, however if this method returns NULL the
  entity will be removed from the resulting collection.
  
  @param \Cake\Collection\CollectionInterface $entities Set of entities to be
  processed
  @param array $args Contains three keys: "options" and "primary" given to the
  originating beforeFind(), and "selectedVirtual", a list of virtual columns
  selected in the originating find query
  @return \Cake\Collection\CollectionInterface New set with altered entities
docstring_tokens: Attach EAV attributes for every entity in the provided result - set .