Neos\Flow\Persistence\Generic\Backend\AbstractBackend::arrayContainsObject PHP Method

arrayContainsObject() protected method

Checks whether the given object is contained in the array. This checks for object identity in terms of the persistence layer, i.e. the UUID, when comparing entities.
protected arrayContainsObject ( array $array, object $object, string $identifier ) : boolean
$array array
$object object
$identifier string
return boolean
    protected function arrayContainsObject(array $array, $object, $identifier)
    {
        if (in_array($object, $array, true) === true) {
            return true;
        }
        foreach ($array as $value) {
            if ($value instanceof $object && $this->persistenceSession->getIdentifierByObject($value) === $identifier) {
                return true;
            }
        }
        return false;
    }