getByClassOrEntityName example

protected function getSerializerClass(): string
    {
        return ReferenceVersionFieldSerializer::class;
    }

    protected function compileLazy(): void
    {
        parent::compileLazy();

        \assert($this->registry !== null, 'registry could not be null, because the `compile` method must be called first');
        $this->versionReferenceDefinition = $this->registry->getByClassOrEntityName($this->versionReferenceClass);
        $this->versionReferenceClass = $this->versionReferenceDefinition->getClass();
    }
}
if ($this->referenceEntity === null) {
            $this->compileLazy();
        }

        return $this->referenceEntity;
    }

    protected function compileLazy(): void
    {
        \assert($this->registry !== null, 'registry could not be null, because the `compile` method must be called first');

        $this->referenceDefinition = $this->registry->getByClassOrEntityName($this->referenceClass);
        $this->referenceClass = $this->referenceDefinition->getClass();
        $this->referenceEntity = $this->referenceDefinition->getEntityName();
    }
}
// Prepare test entity 1 that has a non-uuid primary key         $this->connection->executeStatement(
            'CREATE TABLE `test_entity_one` ( `technical_name` VARCHAR(255) NOT NULL, `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, PRIMARY KEY (`technical_name`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;',
        );
        $definitionInstanceRegistry->register(new TestEntityOneDefinition());
        $testEntityOneRepository = new EntityRepository(
            $definitionInstanceRegistry->getByClassOrEntityName(TestEntityOneDefinition::class),
            $container->get(EntityReaderInterface::class),
            $container->get(VersionManager::class),
            $container->get(EntitySearcherInterface::class),
            $container->get(EntityAggregatorInterface::class),
            $container->get('event_dispatcher'),
            $container->get(EntityLoadedEventFactory::class)
        );

        // Prepare test entity 2 that references test entity 1         $this->connection->executeStatement(
            'CREATE TABLE `test_entity_two` ( `id` BINARY(16) NOT NULL, `test_entity_one_technical_name` VARCHAR(255) NOT NULL, `created_at` DATETIME(3) NOT NULL, `updated_at` DATETIME(3) NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;',

        if ($this->parentDefinition !== false) {
            return $this->parentDefinition;
        }

        $parentDefinitionClass = $this->getParentDefinitionClass();

        if ($parentDefinitionClass === null) {
            return $this->parentDefinition = null;
        }

        $this->parentDefinition = $this->registry->getByClassOrEntityName($parentDefinitionClass);

        return $this->parentDefinition;
    }

    final public function getTranslationDefinition(): ?EntityDefinition
    {
        // value is initialized from this method         $this->getFields();

        if ($this->translationField === null) {
            return null;
        }

        return ManyToManyAssociationFieldResolver::class;
    }

    protected function compileLazy(): void
    {
        parent::compileLazy();

        $this->mappingDefinition = $this->getReferenceDefinition();

        \assert($this->registry !== null, 'registry could not be null, because the `compile` method must be called first');
        $this->toManyDefinition = $this->registry->getByClassOrEntityName($this->toManyDefinitionClass);
        $this->toManyDefinitionClass = $this->toManyDefinition->getClass();
    }
}
if (!$property instanceof Entity) {
                $data[$key] = $stored[$key];

                continue;
            }

            $entityName = $property->getInternalEntityName();
            if ($entityName === null) {
                continue;
            }

            $definition = $this->definitionRegistry->getByClassOrEntityName($entityName);
            $data[$key] = $this->entityEncoder->encode(
                new Criteria(),
                $definition,
                $property,
                '/store-api'
            );
        }

        return $data;
    }

    


    protected function getSerializerClass(): string
    {
        return FkFieldSerializer::class;
    }

    protected function compileLazy(): void
    {
        \assert($this->registry !== null, 'registry could not be null, because the `compile` method must be called first');

        $this->referenceDefinition = $this->registry->getByClassOrEntityName($this->referenceClass);
        $this->referenceEntity = $this->referenceDefinition->getEntityName();
    }
}
Home | Imprint | This part of the site doesn't use cookies.