kachnitel / entity-components-bundle
Reusable Symfony Live Components for entity management (tags, attachments, comments, inline-edit fields)
Package info
github.com/kachnitel/FrdEntityComponentsBundle
Type:symfony-bundle
pkg:composer/kachnitel/entity-components-bundle
Requires
- php: >=8.2
- doctrine/orm: ^2.0|^3.0
- kachnitel/color-converter: ^0.0.1
- symfony/form: ^6.4|^7.0|^8.0
- symfony/framework-bundle: ^6.4|^7.0|^8.0
- symfony/property-access: ^6.4|^7.0|^8.0
- symfony/property-info: ^6.4|^7.0|^8.0
- symfony/security-bundle: ^6.4|^7.0|^8.0
- symfony/type-info: ^7.1|^8.0
- symfony/ux-live-component: ^2.21
- symfony/ux-twig-component: ^2.21
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.51
- marcocesarato/php-conventional-changelog: ^1.17
- phpmd/phpmd: ^2.12
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^11.0
- symfony/browser-kit: ^7.0|^8.0
- symfony/console: ^6.4|^7.0|^8.0
- symfony/css-selector: ^7.0|^8.0
- symfony/phpunit-bridge: ^7.0|^8.0
- symfony/twig-bundle: ^7.0|^8.0
- symfony/yaml: ^6.4|^7.0|^8.0
This package is auto-updated.
Last update: 2026-03-24 19:07:50 UTC
README
Reusable Symfony Live Components for entity management: tags, file attachments, comments, relationship dropdowns, and a full set of inline-edit field components that work with any Doctrine entity.
Quick Start
1. Install
composer require kachnitel/entity-components-bundle
2. Use any component
{{# Inline-edit a text field — any entity property with a setter #}}
<twig:K:Entity:Field:String :entity="user" property="name" />
{{# Tag management #}}
<twig:K:Entity:TagManager :entity="product" tagClass="App\\Entity\\Tag" />
{{# File attachments #}}
<twig:K:Entity:AttachmentManager :entity="product" attachmentClass="App\\Entity\\Attachment" />
{{# Comments #}}
<twig:K:Entity:CommentsManager :entity="article" commentClass="App\\Entity\\Comment" />
{{# Relationship / enum dropdown #}}
<twig:K:Entity:SelectRelationship :entity="order" property="status" />
What's Next?
Inline-edit any field
Level 1: Drop in a field component — click ✎ to edit, save, or cancel:
<twig:K:Entity:Field:String :entity="user" property="name" /> <twig:K:Entity:Field:Int :entity="product" property="stock" /> <twig:K:Entity:Field:Bool :entity="user" property="active" /> <twig:K:Entity:Field:Date :entity="event" property="startsAt" /> <twig:K:Entity:Field:Enum :entity="order" property="status" />
Level 2: Association fields with live search:
<twig:K:Entity:Field:Relationship :entity="product" property="category" /> <twig:K:Entity:Field:Collection :entity="post" property="tags" />
Level 3: Add Symfony Validator constraints to the entity — validation runs automatically before flushing:
#[Assert\NotBlank] #[Assert\Length(max: 100)] private ?string $name = null;
Level 4: Control who can edit by overriding EditabilityResolverInterface:
Kachnitel\EntityComponentsBundle\Components\Field\EditabilityResolverInterface: alias: App\Field\MyEditabilityResolver
Details: Inline-Edit Guide
Tag management
Level 1: Implement TagInterface and TaggableInterface, drop in the component:
<twig:K:Entity:TagManager :entity="product" tagClass="App\\Entity\\Tag" />
Level 2: Read-only badge display:
<twig:K:Entity:TagManager :entity="product" tagClass="App\\Entity\\Tag" :readOnly="true" />
Level 3: Colored categories — return a hex color from getCategoryColor() on your Tag entity. Text color is flipped automatically for contrast.
Details: Tags Guide
File attachments
Level 1: Register a FileHandlerInterface service, implement AttachableInterface, drop in the component:
<twig:K:Entity:AttachmentManager :entity="product" attachmentClass="App\\Entity\\Attachment" />
Level 2: Read-only display, custom collection property:
:config="{ readOnly: true, property: 'media' }"
Level 3: Per-attachment tagging:
:config="{ tagClass: 'App\\Entity\\Tag' }"
Details: Attachments Guide
Comments
Level 1: Implement CommentInterface and CommentableInterface, drop in the component:
<twig:K:Entity:CommentsManager :entity="article" commentClass="App\\Entity\\Comment" />
Level 2: Read-only display, custom collection property:
:config="{ readOnly: true, property: 'notes' }"
Level 3: Limit text length — add a MAX_TEXT_LENGTH constant to your Comment entity and the textarea maxlength is set automatically.
Details: Comments Guide
Relationship / enum dropdown
Level 1: Works out of the box for any entity relation or backed enum:
<twig:K:Entity:SelectRelationship :entity="order" property="region" />
Level 2: Access control, placeholder, label:
:config="{
role: 'ROLE_EDITOR',
placeholder: '— Select Region —',
}"
Level 3: Filter records or use a custom repository method:
:config="{ filter: { active: true } }"
:config="{ repositoryMethod: 'findActive' }"
Details: SelectRelationship Guide
Components at a glance
| Component | Tag | Description |
|---|---|---|
TagManager |
K:Entity:TagManager |
Colored tag badges with category grouping |
AttachmentManager |
K:Entity:AttachmentManager |
File upload and attachment list |
CommentsManager |
K:Entity:CommentsManager |
Threaded comments with delete confirmation |
SelectRelationship |
K:Entity:SelectRelationship |
Eager dropdown for small option sets and enums |
StringField |
K:Entity:Field:String |
Inline text edit |
IntField |
K:Entity:Field:Int |
Inline integer edit |
FloatField |
K:Entity:Field:Float |
Inline decimal edit |
BoolField |
K:Entity:Field:Bool |
Inline checkbox toggle |
DateField |
K:Entity:Field:Date |
Inline date / datetime / time edit |
EnumField |
K:Entity:Field:Enum |
Inline dropdown for PHP backed enums |
RelationshipField |
K:Entity:Field:Relationship |
Live-search inline editor for ManyToOne / OneToOne |
CollectionField |
K:Entity:Field:Collection |
Live-search inline editor for ManyToMany / OneToMany |
Documentation
| Guide | Description |
|---|---|
| Inline-Edit Fields | All field types, validation, editability control, display override |
| Tags | TagManager setup, categories, colors |
| Attachments | AttachmentManager setup, FileHandlerInterface, template blocks |
| Comments | CommentsManager setup, author attribution, text limits |
| SelectRelationship | Dropdown for relations and enums, access control, filtering |
Requirements
- PHP 8.2+
- Symfony 6.4, 7.x, or 8.x
- Doctrine ORM
- Symfony UX Live Component
License
MIT