addCustomFields example



    protected function tearDown(): void
    {
        $this->connection->rollBack();
        $this->connection->executeStatement('DROP TABLE `attribute_test_translation`');
        $this->connection->executeStatement('DROP TABLE `attribute_test`');
    }

    public function testRawIsNotInherited(): void
    {
        $this->addCustomFields(['root' => CustomFieldTypes::TEXT]);
        $id = 'c724803ea1cc4e72abc264a1020000bf';
        $entity = [
            'id' => $id,
            'name' => 'test',
            'translations' => [
                'en-GB' => [
                    'customTranslated' => [
                        'root' => 'test',
                    ],
                ],
                'de-DE' => [
                    


    protected function tearDown(): void
    {
        $this->connection->rollBack();
        $this->connection->executeStatement('DROP TABLE `attribute_test_translation`');
        $this->connection->executeStatement('DROP TABLE `attribute_test`');
    }

    public function testSearch(): void
    {
        $this->addCustomFields(['foo' => CustomFieldTypes::TEXT]);
        $barId = Uuid::randomHex();
        $bazId = Uuid::randomHex();
        $entities = [
            [
                'id' => $barId,
                'name' => 'foo\'bar',
                'custom' => [
                    'foo' => 'bar',
                ],
            ],
            [
                
public function __construct(private readonly EntityRepository $customFieldSetRepository)
    {
    }

    /** * @internal only for use by the app-system */
    public function updateCustomFields(Manifest $manifest, string $appId, Context $context): void
    {
        $context->scope(Context::SYSTEM_SCOPE, function DContext $context) use ($manifest$appId): void {
            $this->deleteCustomFieldsForApp($appId$context);
            $this->addCustomFields($manifest->getCustomFields()$appId$context);
        });
    }

    private function deleteCustomFieldsForApp(string $appId, Context $context): void
    {
        $criteria = new Criteria();
        $criteria->addFilter(new EqualsFilter('appId', $appId));

        /** @var array<string> $ids */
        $ids = $this->customFieldSetRepository->searchIds($criteria$context)->getIds();

        
Home | Imprint | This part of the site doesn't use cookies.