public function getEntitiesByIds($identifier, array $values)
    {
        $accessor = PropertyAccess::createPropertyAccessor();
        return array_filter(is_array($this->entities) ? $this->entities : $this->entities->toArray(), function ($entity) use ($identifier, $values, $accessor) {
            return in_array($accessor->getValue($entity, $identifier), $values);
        });
    }
public function getEntitiesByIds($identifier, array $values)
    {
        $accessor = PropertyAccess::createPropertyAccessor();
        return array_filter(is_array($this->entities) ? $this->entities : $this->entities->toArray(), function ($entity) use ($identifier, $values, $accessor) {
            return in_array($accessor->getValue($entity, $identifier), $values);
        });
    }
Returns an array of entities matching the given identifiers.

@param string $identifier The identifier field of the object. This method
is not applicable for fields with multiple
identifiers.
@param array $values The values of the identifiers.

@return array The entities.