/** * Given a collection of entities gets the ID of all of them. * * This method iterates the given set and invokes `getEntityId()` for every * entity in the set. * * @param \Cake\Collection\CollectionInterface $results Set of entities * @return array List of entity ids suitable for EAV logic */ public function extractEntityIds(CollectionInterface $results) { $entityIds = []; $results->each(function ($entity) use(&$entityIds) { if ($entity instanceof EntityInterface) { $entityIds[] = $this->getEntityId($entity); } }); return $entityIds; }