Whether a given property is annotated with the appropriate bean annotation.

@param string $propertyName The name of the property.
@return boolean
3337
protected function isPropertyAnnotated($propertyName)
    {
        $target = $this->getClass();
        $isAnnotated = false;

        while ($target) {

            if ($target->hasProperty($propertyName)) {
                $comment = $target->getProperty($propertyName)->getDocComment();
                if (empty($comment) === false) {
                    $isAnnotated = mb_strpos($comment, self::ANNOTATION_PROPERTY, 0, 'UTF-8') !== false;

                    if ($isAnnotated === true) {
                        break;
                    }

                }
            }

            $target = $target->getParentClass();
        }

        return $isAnnotated;
    }
1070989
public function markAsIdentityProperty($propertyName)
    {
        if (!array_key_exists($propertyName, $this->properties)) {
            throw new \InvalidArgumentException('Property "' . $propertyName . '" must be added to the class schema before it can be marked as identity property.', 1233775407);
        }
        if ($this->properties[$propertyName]['lazy'] === true) {
            throw new \InvalidArgumentException('Property "' . $propertyName . '" must not be makred for lazy loading to be marked as identity property.', 1239896904);
        }
        $this->identityProperties[$propertyName] = $this->properties[$propertyName]['type'];
    }
710112
public static function parse($model, $propertyName, $annotation)
    {
        if(!$model->$propertyName)
        {
            return;
        }
        $className = BeanFactory::getObjectClass($model);
        $autoInsert = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoInsert::class)[0] ?? null;
        $autoSave = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoSave::class)[0] ?? null;

        if($autoInsert)
        {
            if(!$autoInsert->status)
            {
                return;
            }
        }
        else if(!$autoSave || !$autoSave->status)
        {
            return;
        }

        if($annotation instanceof \Imi\Model\Annotation\Relation\OneToOne)
        {
            static::parseByOneToOne($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\OneToMany)
        {
            static::parseByOneToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\ManyToMany)
        {
            static::parseByManyToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicOneToOne)
        {
            static::parseByPolymorphicOneToOne($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicOneToMany)
        {
            static::parseByPolymorphicOneToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicManyToMany)
        {
            static::parseByPolymorphicManyToMany($model, $propertyName, $annotation);
        }
    }
1045653
public function getProperty($propertyName)
    {
        if ('id' === $propertyName) {
            return $this->getID();
        }

        if (\array_key_exists($propertyName, $this->arrProperties)) {
            return $this->arrProperties[$propertyName];
        }

        return null;
    }
231297
private function isPropertyAccessible($propertyName)
    {
        $result = false;
        $className = get_class($this);
        $reflectionService = ReflectionService::get();

        if ($reflectionService->isClassPropertyAccessible($className, $propertyName)) {
            $property = $reflectionService->getClassAccessibleProperty($className, $propertyName);
            $result = false === $property->isTaggedWith('disableMagicMethods');
        }

        return $result;
    }
699331
public static function getInjectValue($className, $propertyName)
    {
        list($annotations, $configs) = static::getInjects($className);
        if(isset($configs[$propertyName]))
        {
            return $configs[$propertyName];
        }
        else
        {
            $annotation = $annotations[0] ?? null;
            if($annotation)
            {
                return $annotation->getRealValue();
            }
            else
            {
                return null;
            }
        }
    }
1222348
public function isLiteModeProperty(string $propertyName, WriterInterface $writer) : bool
    {
        $outputProperties = [
            'Parent' => 1,
            'Comment' => 1,
            'Browser' => 1,
            'Platform' => 1,
            'Version' => 1,
            'isMobileDevice' => 1,
            'isTablet' => 1,
            'Device_Type' => 1,
        ];

        if (isset($outputProperties[$propertyName])) {
            return true;
        }

        if (WriterInterface::TYPE_INI === $writer->getType()) {
            $additionalProperties = ['PatternId'];

            if (in_array($propertyName, $additionalProperties)) {
                return true;
            }
        }

        return false;
    }
1365631
public function fromProperty(string $propertyName)
    {
        $classType = $this->classType;
        /** @var FinalizedClassDefinition $definition */
        $definition = $classType::definition();
        if (!$definition->hasProperty($propertyName)) {
            throw InvalidArgumentException::format(
                    'Invalid call to %s: property %s::$%s does not exist',
                    __METHOD__, $this->classType, $propertyName
            );
        }

        $this->fromCallback(function (ITypedObject $object) use ($propertyName) {
            return $object->toArray()[$propertyName];
        });
    }
953223
public function getPropertyValidators($propertyName = null)
    {
        if ($propertyName !== null) {
            return $this->propertyValidators[$propertyName] ?? [];
        }
        return $this->propertyValidators;
    }
1330993
public function getPropertyAnnotations($className, $propertyName, $annotationClassName = null)
    {
        $className = $this->prepareClassReflectionForUsage($className);
        if (!isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS])) {
            return [];
        }

        if ($annotationClassName === null) {
            return $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS];
        }

        if (isset($this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName])) {
            return $this->classReflectionData[$className][self::DATA_CLASS_PROPERTIES][$propertyName][self::DATA_PROPERTY_ANNOTATIONS][$annotationClassName];
        }

        return [];
    }
987403
public static function getClassPropertyValue($className, $propertyName)
    {
        $value = BeanProxy::getInjectValue($className, $propertyName);
        if(null === $value)
        {
            if(!class_exists($className))
            {
                $className = BeanParser::getInstance()->getData()[$className]['className'];
            }
            $ref = new \ReflectionClass($className);
            $value = $ref->getDefaultProperties()[$propertyName] ?? null;
        }
        return $value;
    }
37824
public static function initByPolymorphicOneToMany($model, $propertyName, $annotation)
    {
        $className = BeanFactory::getObjectClass($model);

        if(class_exists($annotation->model))
        {
            $modelClass = $annotation->model;
        }
        else
        {
            $modelClass = Imi::getClassNamespace($className) . '\\' . $annotation->model;
        }

        $struct = new PolymorphicOneToMany($className, $propertyName, $annotation);
        $leftField = $struct->getLeftField();
        $rightField = $struct->getRightField();

        $model->$propertyName = new ArrayList($modelClass);
        if(null !== $model->$leftField)
        {
            $list = $modelClass::query()->where($annotation->type, '=', $annotation->typeValue)->where($rightField, '=', $model->$leftField)->select()->getArray();
            if(null !== $list)
            {
                $model->$propertyName->append(...$list);
            }
        }
    }
201755
public static function parseByOneToMany($model, $propertyName, $annotation)
    {
        $className = BeanFactory::getObjectClass($model);

        $struct = new OneToMany($className, $propertyName, $annotation);
        $leftField = $struct->getLeftField();
        $rightField = $struct->getRightField();
        $rightModel = $struct->getRightModel();

        $rightModel::deleteBatch(function(IQuery $query) use($model, $leftField, $rightField){
            $query->where($rightField, '=', $model->$leftField);
        });
    }
955334
public static function hasUpdateRelation($className, $propertyName = null)
    {
        $relations = AnnotationManager::getPropertiesAnnotations($className, RelationBase::class);

        if(empty($relations))
        {
            return false;
        }

        if(null === $propertyName)
        {
            foreach($relations as $name => $annotations)
            {
                $annotation = $annotations[0];
                $autoUpdate = AnnotationManager::getPropertyAnnotations($className, $name, AutoUpdate::class)[0] ?? null;
                $autoSave = AnnotationManager::getPropertyAnnotations($className, $name, AutoSave::class)[0] ?? null;
        
                if($autoUpdate)
                {
                    if(!$autoUpdate->status)
                    {
                        continue;
                    }
                }
                else if(!$autoSave || !$autoSave->status)
                {
                    continue;
                }
            }
        }
        else
        {
            $autoUpdate = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoUpdate::class)[0] ?? null;
            $autoSave = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoSave::class)[0] ?? null;
    
            if($autoUpdate)
            {
                if(!$autoUpdate->status)
                {
                    return false;
                }
            }
            else if(!$autoSave || !$autoSave->status)
            {
                return false;
            }
            return true;
        }
        return false;
    }
425415
public function getProperty($propertyName)
    {
        $className = $className = $this->getClass()->getName();

        if ($this->hasProperty($propertyName) === true) {

            try {
                return new BeanProperty($className, $propertyName);
            } catch (BeanException $e) {
                $msg = "The bean property with name '${propertyName}' in class '${className}' could not be retrieved.";
                throw new BeanException($msg, BeanException::NO_PROPERTY, $e);
            }
        } else {
            $msg = "No bean property with name '${propertyName}' in class '${className}'.";
            throw new BeanException($msg, BeanException::NO_PROPERTY);
        }
    }
335724
public function hasProperty($propertyIdent)
    {
        if (!is_string($propertyIdent)) {
            throw new InvalidArgumentException(
                'Property identifier must be a string.'
            );
        }

        $metadata   = $this->metadata();
        $properties = $metadata->properties();

        return isset($properties[$propertyIdent]);
    }
601201
public static function isPropertyClassArray($class, $propertyName)
    {
        // If the class doesn't exist, or the method doesn't exist, return null.
        if (!class_exists($class) || !method_exists($class, self::getter($class, $propertyName))) {
            return null;
        }

        if (($annotations = self::propertyAnnotations($class, $propertyName)) && isset($annotations['return'])) {
            $param = $annotations['return'];
        }

        if (isset($param)) {
            return substr($param, -strlen('[]')) === '[]';
        } else {
            throw new BlockCypherConfigurationException("Getter function for '$propertyName' in '$class' class should have a proper return type.");
        }
    }