初始化左右关联

@param \Imi\Model\Model $model
@param string $propertyName
@param \Imi\Model\Annotation\Relation\OneToOne $annotation
@return void
769441
public function initLeftAndRight($className, $propertyName, $annotation)
    {
        if(class_exists($annotation->model))
        {
            $this->rightModel = $annotation->model;
        }
        else
        {
            $this->rightModel = Imi::getClassNamespace($className) . '\\' . $annotation->model;
        }
        
        $joinFrom = AnnotationManager::getPropertyAnnotations($className, $propertyName, JoinFrom::class)[0] ?? null;
        $joinTo = AnnotationManager::getPropertyAnnotations($className, $propertyName, JoinTo::class)[0] ?? null;

        if($joinFrom)
        {
            $this->leftField = $joinFrom->field;
        }
        else
        {
            $this->leftField = ModelManager::getFirstId($className);
        }

        if($joinTo)
        {
            $this->rightField = $joinTo->field;
        }
        else
        {
            $this->rightField = Text::toUnderScoreCase(Imi::getClassShortName($className)) . '_id';
        }
    }
536769
public static function collect(
        string $className,
        $objectAnnotation = null,
        string $propertyName = '',
        string $methodName = '',
        $propertyValue = null
    ) {
        if ($objectAnnotation instanceof Command) {
            self::collectCommand($className, $objectAnnotation);
        } elseif ($objectAnnotation instanceof Mapping) {
            self::collectMapping($className, $objectAnnotation, $methodName);
        } elseif ($objectAnnotation === null && isset(self::$commandMapping[$className])) {
            self::collectWithoutAnnotation($className, $methodName);
        }
    }
625971
private function createGetter(Entity $entity, $property, $annotation)
    {
        if ($annotation->getter === null) {
            $getter = new PropertyGetter($entity, $property);
        } else {
            if ($annotation->getter === true) {
                $methodName = 'get' . ucfirst($property);
            } else {
                $methodName = $annotation->getter;
            }
            $getter = new MethodGetter($entity, $methodName);
        }

        return $getter;
    }
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;
    }
387714
public static function collect(
        string $className,
        $objectAnnotation = null,
        string $propertyName = '',
        string $methodName = '',
        $propertyValue = null
    ) {
        if ($objectAnnotation instanceof Strings) {
            self::collectString($objectAnnotation, $className, $methodName);
        } elseif ($objectAnnotation instanceof Floats) {
            self::collectFloats($objectAnnotation, $className, $methodName);
        } elseif ($objectAnnotation instanceof Number) {
            self::collectNumber($objectAnnotation, $className, $methodName);
        } elseif ($objectAnnotation instanceof Integer) {
            self::collectInteger($objectAnnotation, $className, $methodName);
        } elseif ($objectAnnotation instanceof Enum) {
            self::collectEnum($objectAnnotation, $className, $methodName);
        }
    }
1305688
protected function createAttributeByProperty(AttributeAnnotation $annotation, \ReflectionProperty $property): Attribute
    {
        $name = ($annotation->name === null)
            ? $property->getName()
            : $annotation->name;

        $getter = ($annotation->getter === null)
            ? $this->resolveGetter($property)
            : $annotation->getter;

        $setter = ($annotation->setter === null)
            ? $this->resolveSetter($property)
            : $annotation->setter;

        $attribute = new Attribute($name, $getter);
        $attribute->setPropertyName($property->getName());

        if ($setter !== null) {
            $attribute->setSetter($setter);
        }

        $this->processAttributeOptions($annotation, $attribute);

        return $attribute;
    }
1340989
protected function setAdditionalColumnProperties($name, Annotation &$annotation, array $propertyAnnotations, $embedded=false, $columnPrefix=false)
    {
        // scan for primary and versioned property
        foreach ($propertyAnnotations as $subAnnotation) {
            // set primary key
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\Id) {
                $annotation->primary = true;
            }
            // set auto increment
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\AutoIncrement) {
                $annotation->autoIncrement = true;
            }
            // set auto increment
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\AutoUuid) {
                $annotation->autoUuid = true;
            }
            // set versioned
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\Versioned) {
                $annotation->versioned = true;
            }
        }

        // set column name
        $annotation->name = $this->getColumnName($annotation->name ?: $name, $columnPrefix);
    }
938315
protected function properties(Model $model)
    {
        // Process property annotations
        $annotations = '';

        foreach ($model->getProperties() as $name => $hint) {
            $annotations .= $this->class->annotation('property', "$hint \$$name");
        }

        if ($model->hasRelations()) {
            // Add separation between model properties and model relations
            $annotations .= "\n * ";
        }

        foreach ($model->getRelations() as $name => $relation) {
            // TODO: Handle collisions, perhaps rename the relation.
            if ($model->hasProperty($name)) {
                continue;
            }
            $annotations .= $this->class->annotation('property', $relation->hint()." \$$name");
        }

        return $annotations;
    }
226214
public static function collect(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        if ($objectAnnotation instanceof Breaker) {
            $breakerName = $objectAnnotation->getName();
            $breakerName = empty($breakerName) ? $className : $breakerName;

            self::$breakers[$breakerName] = $className;
        }
    }
525906
public static function collect(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        if ($objectAnnotation instanceof Definition) {

            $name = $objectAnnotation->getName();
            self::$definitions[$className] = empty($name) ? $className : $name;
        }
    }
875682
public static function parseByManyToMany($model, $propertyName, $annotation)
    {
        $className = BeanFactory::getObjectClass($model);

        $struct = new ManyToMany($className, $propertyName, $annotation);
        $middleModel = $struct->getMiddleModel();
        $middleLeftField = $struct->getMiddleLeftField();
        $leftField = $struct->getLeftField();

        foreach($model->$propertyName as $index => $row)
        {
            if(!$row instanceof $middleModel)
            {
                $row = $middleModel::newInstance($row);
                $model->$propertyName[$index] = $row;
            }
            $row[$middleLeftField] = $model->$leftField;
            $row->insert();
        }
    }
426895
public static function getPropertyAnnotation(\ReflectionProperty $property, $annotationClass, AnnotationReader $reader)
    {
        return $reader->getPropertyAnnotation($property, $annotationClass);
    }
219080
public static function collect(
        string $className,
        $objectAnnotation = null,
        string $propertyName = '',
        string $methodName = '',
        $propertyValue = null
    ) {
        if ($objectAnnotation instanceof Statement) {
            $driver                    = $objectAnnotation->getDriver();
            self::$statements[$driver] = $className;
        }
    }
1007396
public function relation(string $propertyName) : RelationAliasDefiner
    {
        $this->verifyClassDefined(__METHOD__);
        $this->verifyMapperDefined(__METHOD__);

        if (!isset($this->relations[$propertyName])) {
            throw InvalidArgumentException::format(
                'Invalid property to load from parent %s: property must be mapped to a relation, \'%s\' given',
                $this->mapper->getObjectType(), $propertyName
            );
        }

        /** @var IToOneRelation $relation */
        $relation   = $this->relations[$propertyName];
        $definition = new self($this->orm);
        $definition->from($relation->getMapper());

        return new RelationAliasDefiner($definition, function ($alias, callable $relationReferenceLoader) use ($relation
        ) {
            if ($relation instanceof IToOneRelation) {
                $relation = $relation->withReference($relationReferenceLoader($relation));
            } elseif ($relation instanceof IToManyRelation) {
                $relation = $relation->withReference($relationReferenceLoader($relation));
            }

            if (is_string($alias)) {
                $relationDefiner = $this->readDefinition->relation($alias);
            } else {
                $relationDefiner = $this->readDefinition->accessorRelation(function () {
                }, $alias);
            }

            $relationDefiner->asCustom($relation);
            $this->loadRelationColumns($relation);
        });
    }
532958
public static function setPropertyValue($object,$propertyName,$value)
    {
        $setter = "set" . ucfirst($propertyName);
        if (method_exists($object, $setter)) {
            $object->$setter($value);
        }
    }
106506
public static function readProperty( $property , $annotation = null ) {

		$ref = $property instanceof ReflectionProperty ? $property : new ReflectionProperty( $property[0] , $property[1] );

		return $annotation ? static::reader()->getPropertyAnnotation( $ref , $annotation ) : static::reader()->getPropertyAnnotations( $ref );

	}
458222
public static function parseByPolymorphicOneToOne($model, $propertyName, $annotation)
    {
        $className = BeanFactory::getObjectClass($model);

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

        $model->$propertyName->$rightField = $model->$leftField;
        $model->$propertyName->{$annotation->type} = $annotation->typeValue;
        $model->$propertyName->insert();
    }