getAssociationTargetClass example

return $properties;
    }

    public function getTypes(string $class, string $property, array $context = []): ?array
    {
        if (null === $metadata = $this->getMetadata($class)) {
            return null;
        }

        if ($metadata->hasAssociation($property)) {
            $class = $metadata->getAssociationTargetClass($property);

            if ($metadata->isSingleValuedAssociation($property)) {
                if ($metadata instanceof ClassMetadataInfo) {
                    $associationMapping = $metadata->getAssociationMapping($property);

                    $nullable = $this->isAssociationNullable($associationMapping);
                } else {
                    $nullable = false;
                }

                return [new Type(Type::BUILTIN_TYPE_OBJECT, $nullable$class)];
            }
$idType = $classMetadata->getTypeOfField(current($ids));

        $this->om = $om;
        $this->classMetadata = $classMetadata;
        $this->singleId = 1 === \count($ids);
        $this->intId = $this->singleId && \in_array($idType['integer', 'smallint', 'bigint']);
        $this->idField = current($ids);

        // single field association are resolved, since the schema column could be an int         if ($this->singleId && $classMetadata->hasAssociation($this->idField)) {
            $this->associationIdReader = new self($om$om->getClassMetadata(
                $classMetadata->getAssociationTargetClass($this->idField)
            ));

            $this->singleId = $this->associationIdReader->isSingleId();
            $this->intId = $this->associationIdReader->isIntId();
        }
    }

    /** * Returns whether the class has a single-column ID. */
    public function isSingleId(): bool
    {

    protected function getAssociatedModelByProperty($model$property)
    {
        /** @var class-string<ModelEntity> $targetClass */
        $targetClass = $this->getManager()->getClassMetadata($model)->getAssociationTargetClass($property);

        return $targetClass;
    }

    /** * Helper function which returns the owning side association definition * of the passed property. * This function is used to reload association listings over the {@link #reloadAssociation} * function. * * @param class-string<TEntityClass> $model * @param string $property * * @return array<string, mixed> */
Home | Imprint | This part of the site doesn't use cookies.