Inherited example

public function since(): ?string
    {
        return '6.0.0.0';
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new ApiAware()new PrimaryKey()),

            (new StringField('name', 'name'))->addFlags(new Inherited()),
            (new CustomFields())->addFlags(new ApiAware()),
        ]);
    }
}

        $fields->add(
            (new JsonField('calculated_cheapest_price', 'calculatedCheapestPrice'))->addFlags(new ApiAware()new Runtime(\array_merge(self::PRICE_BASELINE, ['cheapestPrice'])))
        );
        $fields->add(
            (new BoolField('is_new', 'isNew'))->addFlags(new ApiAware()new Runtime(['releaseDate']))
        );
        $fields->add(
            (new OneToOneAssociationField('seoCategory', 'seoCategory', 'id', CategoryDefinition::class))->addFlags(new ApiAware()new Runtime())
        );
        $fields->add(
            (new CheapestPriceField('cheapest_price', 'cheapestPrice'))->addFlags(new WriteProtected()new Inherited()new ApiCriteriaAware())
        );
        $fields->add(
            (new ObjectField('cheapest_price_container', 'cheapestPriceContainer'))->addFlags(new Runtime())
        );
        $fields->add(
            (new ObjectField('sortedProperties', 'sortedProperties'))->addFlags(new Runtime()new ApiAware())
        );

        $fields->add(
            (new ObjectField('sortedProperties', 'sortedProperties'))->addFlags(new Runtime()new ApiAware())
        );

        
                $property = self::kebabCaseToCamelCase($definition->getEntityName());

                // reverse property schema: #table#_#column# - custom_entity_blog_products                 $association = new ManyToManyAssociationField($property$entityName$definition->getEntityName()$field['reference'] . '_id', $entityName . '_id');
                $association->addFlags(new CascadeDelete());

                // if reference is not a custom entity definition, we need to add the dal extension flag to get the hydrated objects as `entity.extensions` value                 self::addFlag($association, self::getExtension($reference));

                // check for product inheritance use case                 if ($reference->isInheritanceAware() && $inherited) {
                    $association->addFlags(new Inherited());
                }

                $association->compile($registry);
                $reference->getFields()->addField($association);

                break;

            case 'many-to-one':
                // get reference entity definition to create bi-directionally associations                 $reference = $registry->getByEntityName($field['reference']);

                
return ProductHydrator::class;
    }

    protected function defineFields(): FieldCollection
    {
        $fields = new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new ApiAware()new PrimaryKey()new Required()),
            (new VersionField())->addFlags(new ApiAware()),
            (new ParentFkField(self::class))->addFlags(new ApiAware()),
            (new ReferenceVersionField(self::class, 'parent_version_id'))->addFlags(new ApiAware()new Required()),

            (new FkField('product_manufacturer_id', 'manufacturerId', ProductManufacturerDefinition::class))->addFlags(new ApiAware()new Inherited()),
            (new ReferenceVersionField(ProductManufacturerDefinition::class))->addFlags(new ApiAware()new Inherited()new Required()),
            (new FkField('unit_id', 'unitId', UnitDefinition::class))->addFlags(new ApiAware()new Inherited()),
            (new FkField('tax_id', 'taxId', TaxDefinition::class))->addFlags(new ApiAware()new Inherited()new Required()),
            (new FkField('product_media_id', 'coverId', ProductMediaDefinition::class))->addFlags(new ApiAware()new Inherited()new NoConstraint()),
            (new ReferenceVersionField(ProductMediaDefinition::class))->addFlags(new ApiAware()new Inherited()new Required()),
            (new FkField('delivery_time_id', 'deliveryTimeId', DeliveryTimeDefinition::class))->addFlags(new ApiAware()new Inherited()),
            (new FkField('product_feature_set_id', 'featureSetId', ProductFeatureSetDefinition::class))->addFlags(new Inherited()),
            (new FkField('canonical_product_id', 'canonicalProductId', ProductDefinition::class))->addFlags(new ApiAware()new Inherited()),
            (new FkField('cms_page_id', 'cmsPageId', CmsPageDefinition::class))->addFlags(new ApiAware()new Inherited()),
            (new ReferenceVersionField(CmsPageDefinition::class))->addFlags(new Inherited()new Required()new ApiAware()),

            (
public function since(): ?string
    {
        return '6.0.0.0';
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new Required()new PrimaryKey()),
            new VersionField(),

            (new DateTimeField('my_date', 'myDate'))->addFlags(new Inherited()),

            (new ReferenceVersionField(ProductDefinition::class))->addFlags(new Required()),
            (new FkField('product_id', 'productId', ProductDefinition::class))->addFlags(new Required()),
            (new OneToOneAssociationField('product', 'product_id', 'id', ProductDefinition::class, false))->addFlags(new ReverseInherited('oneToOneInherited')),
        ]);
    }
}
public function since(): ?string
    {
        return '6.0.0.0';
    }

    protected function defineFields(): FieldCollection
    {
        return new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new ApiAware()new PrimaryKey()),
            (new IdField('parent_id', 'parentId'))->addFlags(new ApiAware()new PrimaryKey()),
            (new ParentFkField(self::class))->addFlags(new ApiAware()),
            (new StringField('name', 'name'))->addFlags(new Inherited()),
            (new TranslatedField('customTranslated'))->addFlags(new Inherited()),
            (new CustomFields('custom', 'custom'))->addFlags(new Inherited()),
            (new TranslationsAssociationField(CustomFieldTestTranslationDefinition::class, 'attribute_test_id'))->addFlags(new ApiAware()),
            // parent - child inheritance             (new ParentAssociationField(self::class, 'id'))->addFlags(new ApiAware()),
            (new ChildrenAssociationField(self::class))->addFlags(new ApiAware()),
        ]);
    }
}
protected function defineFields(): FieldCollection
    {
        $collection = new FieldCollection([
            (new IdField('id', 'id'))->addFlags(new PrimaryKey()new Required()),
            new LockedField(),
            (new StringField('url_key', 'key'))->addFlags(new ApiAware()new Required()),
            (new IntField('priority', 'priority'))->addFlags(new ApiAware()new Required()),
            (new BoolField('active', 'active'))->addFlags(new Required()),
            (new JsonField('fields', 'fields'))->addFlags(new Required()),
            (new TranslatedField('label'))->addFlags(new ApiAware()),
            (new TranslationsAssociationField(ProductSortingTranslationDefinition::class, 'product_sorting_id'))->addFlags(new Inherited()new Required()),
        ]);

        return $collection;
    }
}
class OneToOneInheritedProductExtension extends EntityExtension
{
    public function extendFields(FieldCollection $collection): void
    {
        $collection->add(
            (new OneToOneAssociationField(
                'oneToOneInherited',
                'id',
                'product_id',
                OneToOneInheritedProductDefinition::class,
                true
            ))->addFlags(new CascadeDelete()new Inherited())
        );
    }

    public function getDefinitionClass(): string
    {
        return ProductDefinition::class;
    }
}
new DAL\LongTextField('content', 'content'))->addFlags(new DAL\Flag\AllowHtml()),
                new DAL\BoolField('display', 'display'),
            ],
            'product' => [
                (new ManyToManyAssociationField('customEntityBlogProducts', 'custom_entity_blog', 'custom_entity_blog_products', 'product_id', 'custom_entity_blog_id', 'id', 'id'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()),
                (new DAL\OneToOneAssociationField('customEntityBlogLinkProductRestrict', 'id', 'link_product_restrict_id', 'custom_entity_blog'))->addFlags(new DAL\Flag\RestrictDelete()new Extension()),
                (new DAL\OneToOneAssociationField('customEntityBlogLinkProductCascade', 'id', 'link_product_cascade_id', 'custom_entity_blog'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()),
                (new DAL\OneToOneAssociationField('customEntityBlogLinkProductSetNull', 'id', 'link_product_set_null_id', 'custom_entity_blog'))->addFlags(new DAL\Flag\SetNullOnDelete()new Extension()),
                (new OneToManyAssociationField('customEntityBlogTopSellerCascade', 'custom_entity_blog', 'top_seller_cascade_id'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()),
                (new OneToManyAssociationField('customEntityBlogTopSellerRestrict', 'custom_entity_blog', 'top_seller_restrict_id'))->addFlags(new DAL\Flag\RestrictDelete()new Extension()),
                (new OneToManyAssociationField('customEntityBlogTopSellerSetNull', 'custom_entity_blog', 'top_seller_set_null_id'))->addFlags(new DAL\Flag\SetNullOnDelete()new Extension()),
                (new ManyToManyAssociationField('customEntityBlogInheritedProducts', 'custom_entity_blog', 'custom_entity_blog_inherited_products', 'product_id', 'custom_entity_blog_id', 'id', 'id'))->addFlags(new DAL\Flag\CascadeDelete()new Extension()new DAL\Flag\Inherited()),
                (new OneToManyAssociationField('customEntityBlogInheritedTopSeller', 'custom_entity_blog', 'inherited_top_seller_id'))->addFlags(new DAL\Flag\SetNullOnDelete()new DAL\Flag\Inherited()new Extension()),
            ],
        ];

        foreach ($expected as $entity => $properties) {
            $definition = $container
                ->get(DefinitionInstanceRegistry::class)
                ->getByEntityName($entity);

            foreach ($properties as $field) {
                $field->compile($container->get(DefinitionInstanceRegistry::class));

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