Neos\Flow\Persistence\Generic\Backend\AbstractBackend::checkPropertyValue PHP Метод

checkPropertyValue() защищенный Метод

Check the property value for allowed types and throw exceptions for unsupported types.
protected checkPropertyValue ( object $object, string $propertyName, array $propertyMetaData ) : mixed
$object object The object with the property to check
$propertyName string The name of the property to check
$propertyMetaData array Property metadata
Результат mixed The value of the property
    protected function checkPropertyValue($object, $propertyName, array $propertyMetaData)
    {
        $propertyValue = ObjectAccess::getProperty($object, $propertyName, true);
        $propertyType = $propertyMetaData['type'];
        if ($propertyType === 'ArrayObject') {
            throw new PersistenceException('ArrayObject properties are not supported - missing feature?!?', 1283524355);
        }
        if (is_object($propertyValue)) {
            if ($propertyType === 'object') {
                if (!$propertyValue instanceof PersistenceMagicInterface) {
                    throw new IllegalObjectTypeException('Property of generic type object holds "' . get_class($propertyValue) . '", which is not persistable (no entity or value object), in ' . get_class($object) . '::' . $propertyName, 1283531761);
                }
            } elseif (!$propertyValue instanceof $propertyType) {
                throw new UnexpectedTypeException('Expected property of type ' . $propertyType . ', but got ' . get_class($propertyValue) . ' for ' . get_class($object) . '::' . $propertyName, 1244465558);
            }
        } elseif ($propertyValue !== null && $propertyType !== $this->getType($propertyValue)) {
            throw new UnexpectedTypeException('Expected property of type ' . $propertyType . ', but got ' . gettype($propertyValue) . ' for ' . get_class($object) . '::' . $propertyName, 1244465559);
        }
        return $propertyValue;
    }