frameworkmakeentity
Génère une entité Doctrine avec repository selon principes Elegant Objects
When & Why to Use This Skill
This Claude skill automates the generation of Doctrine entities and repositories based on 'Elegant Objects' principles. It helps developers maintain a clean, object-oriented architecture by producing final classes, static factories, and repository interfaces, significantly reducing manual boilerplate and ensuring architectural consistency in PHP projects.
Use Cases
- Rapidly bootstrapping new database entities in Symfony or PHP projects while adhering to strict OOP standards.
- Enforcing architectural consistency across a team by automating the creation of standardized repository patterns and interfaces.
- Reducing development time and manual errors when implementing complex entity traits such as logging, dependency injection, and UUID identification.
- Modernizing legacy codebases by generating clean, immutable entity structures that follow best practices like private constructors and static factories.
| name | framework:make:entity |
|---|---|
| description | Génère une entité Doctrine avec repository selon principes Elegant Objects |
| license | MIT |
| version | 1.0.0 |
Framework Make Entity Skill
Description
Génère une entité Doctrine complète avec son repository selon les principes Elegant Objects.
Usage
Use skill framework:make:entity
Variables requises
- {EntityName} - Nom de l'entité en PascalCase (ex: Product)
- {entityName} - Nom de l'entité en camelCase (ex: product)
- {namespace} - Namespace du projet (défaut: App)
- {properties} - Liste des propriétés avec types (name:string, price:float)
Dépendances
- Contracts présents (appelle
framework:make:contractssi absent)
Outputs
src/Entity/{EntityName}.phpsrc/Repository/{EntityName}Repository.phpsrc/Repository/{EntityName}RepositoryInterface.php
Workflow
- Demander le nom de l'entité (EntityName)
- Demander les propriétés (nom, type, nullable)
- Vérifier si
src/Contracts/existe, sinon appelerframework:make:contracts - Générer l'entité depuis le template
templates/Entity/ - Générer le repository et son interface
- Afficher le résumé des fichiers créés
Patterns appliqués
Entité
- Classe
final, constructeur privé, factory statiquecreate() - Traits : DatabaseTrait, NullTrait, DependencyInjectionTrait
- Interfaces : LoggableInterface, DatabaseEntityInterface, NullableInterface, DependencyInjectionAwareInterface, OutInterface, HasUrlsInterface, InvalideInterface
Repository
- Classe
final, extends ServiceEntityRepository - Implémente interface du repository
References
- Usage - Exemples et détails de génération
Notes
- ID Uuid ajouté automatiquement
- Propriétés privées avec getters (pas de setters)
- Méthode
toLog()inclut toutes les propriétés