Constructs an ObjectIdentity for the given domain object.

@param object $domainObject

@throws InvalidDomainObjectException

@return ObjectIdentity
181321
public static function fromDomainObject($domainObject)
    {
        if (!is_object($domainObject)) {
            throw new InvalidDomainObjectException('$domainObject must be an object.');
        }

        try {
            if ($domainObject instanceof HierarchicalDomainObjectInterface) {
                return new self(
                    $domainObject->getHierarchicalObjectIdentifiers(),
                    $domainObject->getObjectIdentifier(),
                    ClassUtils::getRealClass($domainObject)
                );
            }

            return parent::fromDomainObject($domainObject);
        } catch (\InvalidArgumentException $invalid) {
            throw new InvalidDomainObjectException($invalid->getMessage(), 0, $invalid);
        }

        throw new InvalidDomainObjectException('$domainObject must either implement the HierarchicalDomainObjectInterface, DomainObjectInterface, or have a method named "getId".');
    }
670259
public function newObject($entity, $jsonObject)
	{
		$retValue = array();

		if (! is_null($this->_conn)){
			$last_user_id = $this->_conn->insert($entity, array($jsonObject));

			if (! $this->error($this->_conn->error()))
				return $this->findObject($entity, $last_user_id);
		}
		
		return $retValue;
	}
1026201
public function getIdentifier($object)
    {
        $identifier = $this->getMethod($object);

        if (!$identifier) {
            return false;
        }

        return \call_user_func([$object, $identifier]);
    }
834616
public function assertObjectInstance($object)
    {
        if (!$object instanceof $this->className) {
            if (is_object($object)) {
                $className = get_class($object);
            } else {
                $className = gettype($object);
            }
            throw new \InvalidArgumentException("Object must be an instance of {$this->className}, {$className} given");
        }
    }
1080522
public function set($object = null)
    {
        if (null !== $object && !$object instanceof Language) {
            throw new General\InvalidArgumentTypeException('exception_only_language_objects_are_accepted');
        }

        $this->alLanguage = $object;

        return $this;
    }
615483
protected function persistObject($object, $parentIdentifier)
    {
        if (isset($this->visitedDuringPersistence[$object])) {
            return $this->visitedDuringPersistence[$object];
        }

        $identifier = $this->persistenceSession->getIdentifierByObject($object);
        $this->visitedDuringPersistence[$object] = $identifier;

        $objectData = [];
        $objectState = $this->storeObject($object, $identifier, $parentIdentifier, $objectData);

        if ($this->reflectionService->getClassSchema($object)->getModelType() === ClassSchema::MODELTYPE_ENTITY) {
            $this->persistenceSession->registerReconstitutedEntity($object, $objectData);
        }
        $this->emitPersistedObject($object, $objectState);

        return $identifier;
    }
8912
public function identitiesAction(Request $request)
    {
        $objectType = $request->get('objectType');
        $objectId = $request->get('objectId', null);

        $objectIdentityResolver = $this->get('phlexible_access_control.object_identity_resolver');
        $objectIdentity = $objectIdentityResolver->resolve($objectType, $objectId);

        if (!$objectIdentity) {
            throw new \InvalidArgumentException("Unsupported object type $objectType");
        }

        $accessManager = $this->get('phlexible_access_control.access_manager');

        $acl = $accessManager->findAcl($objectIdentity);

        return new JsonResponse(array('identities' => $this->createIdentities($acl)));
    }
1045075
final protected function retrieveObjectIdentityPrimaryKey(ObjectIdentityInterface $oid)
    {
        return $this->connection->executeQuery($this->getSelectObjectIdentityIdSql($oid))->fetchColumn();
    }
700402
public function getId($object)
    {
        if (false === $this->hasObject($object)) {
            throw new \OutOfBoundsException('no object=' . get_class($object) . ' at the identity-map');
        }

        return $this->objectToId[$object];
    }
699494
protected function objectToKey($object)
    {
        $typeName = $object instanceof AppliesToResource ? $object->resourceName() : get_class($object);

        if (!$object instanceof Identifiable) {
            throw new InvalidArgumentException('Cannot generate cache id of unknown class '.get_class($object));
        }

        return $typeName.'_'.$object->getId();
    }
1342493
public function toResourceIdentifier($object): ResourceIdentifierObject
    {
        $context = $this->createContext(get_class($object));

        $id   = $this->identifierHandler->getIdentifier($object, $context);
        $type = $this->resolveType($object, $context);

        return new ResourceIdentifierObject($id, $type);
    }
209774
public static function fromClassname($class)
    {
        try {
            if (!class_exists($class)) {
                throw new InvalidArgumentException(sprintf('The class "%s" does not exist', $class));
            }

            return new self(ClassUtils::getRealClass($class), 'class');
        } catch (InvalidArgumentException $e) {
            throw new InvalidSubjectIdentityException($e->getMessage(), 0, $e);
        }
    }
861610
public DomainObjectMatch<DomainObject> createMatch(String domainObjectTypeName) {
		InternalDomainAccess iAccess = this.queryExecutor.getMappingInfo().getInternalDomainAccess();
		try {
			iAccess.loadDomainInfoIfNeeded();
			Class<?> clazz = iAccess.getClassForName(domainObjectTypeName);
			DomainObjectMatch<?> delegate = createMatchInternal(clazz);
			DomainObjectMatch<DomainObject> ret = APIAccess.createDomainObjectMatch(DomainObject.class, delegate);
			QueryRecorder.recordAssignment(this, "createMatch", delegate, QueryRecorder.literal(domainObjectTypeName));
			return ret;
		} catch (Throwable e) {
			if (e instanceof RuntimeException)
				throw (RuntimeException)e;
			else
				throw new RuntimeException(e);
		}
	}
1353009
protected function registerNew(PersistentObject $object) {
    $key = $object->getOID()->__toString();
    if (self::$isDebugEnabled) {
      self::$logger->debug("Register new object: ".$key);
    }
    $this->newObjects[$key] = $object;
    $this->observedObjects[$key] = $object;
    return $object;
  }
1133020
public function bindTo(string $valueObjectClass)
    {
        /** @var string|TypedObject $valueObjectClass */
        if (!is_subclass_of($valueObjectClass, IValueObject::class, true)) {
            throw InvalidArgumentException::format(
                'Invalid value object class supplied to %s: expecting subclass of %s, %s given',
                __METHOD__, IValueObject::class, $valueObjectClass
            );
        }

        $this->class = $valueObjectClass::definition();
    }
1080923
public function create($pageObjectClass)
    {
        if (is_subclass_of($pageObjectClass, 'SensioLabs\Behat\PageObjectExtension\PageObject\Page')) {
            return $this->instantiatePage($pageObjectClass);
        } elseif (is_subclass_of($pageObjectClass, 'SensioLabs\Behat\PageObjectExtension\PageObject\Element')) {
            return $this->instantiateElement($pageObjectClass);
        }

        throw new \InvalidArgumentException(sprintf('Not a page object class: %s', $pageObjectClass));
    }
820985
public static function createFromObject($object)
    {
        if ($object instanceof ObjectIdentity) {
            return new static($object->getIdentifier());
        }
        
        $name = get_class($object);
        $hash = static::getObjectHash($object, 'sha256');
        
        $identifier = sprintf('%s@%s', $name, $hash);
        
        return new static($identifier, $name);
    }