Help us improve
Share bugs, ideas, or general feedback.
From orocommerce-skills
Use when creating new OroCommerce v6.1 Doctrine entities, extending existing Oro core entities (like Product, Order, Customer), writing schema migrations, configuring entity ownership (USER, BUSINESS_UNIT, ORGANIZATION, GLOBAL), using ConfigField attributes, creating enum entities, or working with ExtendEntity traits. Relevant when the user mentions 'create entity', 'add field to Product', 'write migration', 'extend entity', 'custom field', or entity ownership questions in OroCommerce context.
npx claudepluginhub netresearch/claude-code-marketplace --plugin orocommerceHow this skill is triggered — by the user, by Claude, or both
Slash command
/orocommerce-skills:oro-entityThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
This is the reference pattern combining `ExtendEntityInterface`, ownership, security, and `#[ConfigField]`:
Mandates invoking relevant skills via tools before any response in coding sessions. Covers access, priorities, and adaptations for Claude Code, Copilot CLI, Gemini CLI.
Share bugs, ideas, or general feedback.
This is the reference pattern combining ExtendEntityInterface, ownership, security, and #[ConfigField]:
<?php
namespace Acme\Bundle\DemoBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Oro\Bundle\EntityConfigBundle\Metadata\Attribute\Config;
use Oro\Bundle\EntityConfigBundle\Metadata\Attribute\ConfigField;
use Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityInterface;
use Oro\Bundle\EntityExtendBundle\Entity\ExtendEntityTrait;
use Oro\Bundle\OrganizationBundle\Entity\Organization;
use Oro\Bundle\UserBundle\Entity\User;
#[ORM\Entity]
#[ORM\Table(name: 'acme_demo_document')]
#[Config(
routeName: 'acme_demo_document_index',
routeView: 'acme_demo_document_view',
defaultValues: [
'entity' => ['icon' => 'fa-file', 'label' => 'Document', 'plural_label' => 'Documents'],
'ownership' => [
'owner_type' => 'USER',
'owner_field_name' => 'owner',
'owner_column_name' => 'user_owner_id',
'organization_field_name' => 'organization',
'organization_column_name' => 'organization_id',
],
'security' => ['type' => 'ACL', 'permissions' => 'VIEW;CREATE;EDIT;DELETE', 'group_name' => ''],
]
)]
class Document implements ExtendEntityInterface
{
use ExtendEntityTrait;
#[ORM\Id]
#[ORM\GeneratedValue(strategy: 'AUTO')]
#[ORM\Column(type: 'integer')]
private ?int $id = null;
#[ORM\Column(type: 'string', length: 255)]
#[ConfigField(defaultValues: ['dataaudit' => ['auditable' => true]])]
private string $title;
#[ORM\ManyToOne(targetEntity: User::class)]
#[ORM\JoinColumn(name: 'user_owner_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
private ?User $owner = null;
#[ORM\ManyToOne(targetEntity: Organization::class)]
#[ORM\JoinColumn(name: 'organization_id', referencedColumnName: 'id', onDelete: 'SET NULL')]
private ?Organization $organization = null;
// Getters/setters...
}
Use ExtendEntityInterface + ExtendEntityTrait only when admin users need to add custom fields at runtime via Entity Management (System -> Entity Management). The trait provides magic __get/__set/__isset/__call for runtime-added fields. Standard entities that won't be extended at runtime don't need it.
CRITICAL: USER and BUSINESS_UNIT ownership both require an organization field. Missing it causes silent access control failures. See references/ownership-types.md for full config of all four types.
namespace Acme\Bundle\DemoBundle\Migrations\Schema\v1_0;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\MigrationBundle\Migration\Migration;
use Oro\Bundle\MigrationBundle\Migration\QueryBag;
class CreateDocumentTable implements Migration
{
public function up(Schema $schema, QueryBag $queries): void
{
$table = $schema->createTable('acme_demo_document');
$table->addColumn('id', 'integer', ['autoincrement' => true]);
$table->addColumn('subject', 'string', ['length' => 255]);
$table->addColumn('organization_id', 'integer', ['notnull' => false]);
$table->addColumn('owner_id', 'integer', ['notnull' => false]);
$table->setPrimaryKey(['id']);
}
}
Place migrations in src/Acme/Bundle/DemoBundle/Migrations/Schema/. Organize by version subdirectories (v1_0/, v1_1/).
@ORM\ annotations instead of #[ORM\...] attributes — Doctrine won't recognize them in v6.1references/ownership-types.md — Complete ownership type configurations and field requirementsreferences/entity-patterns.md — Enum entities, ConfigField details, extending core entities, repositories, commands, additional pitfallsreferences/v6.1.md — v6.1 specifics, migration checklist, and common failuresreferences/v7.0.md — v7.0 changes (placeholder)