framework:make:entity

Génère une entité Doctrine avec repository selon principes Elegant Objects

8 stars

Best use case

framework:make:entity is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Génère une entité Doctrine avec repository selon principes Elegant Objects

Teams using framework:make:entity should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/make-entity/SKILL.md --create-dirs "https://raw.githubusercontent.com/atournayre/claude-marketplace/main/framework/skills/make-entity/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/make-entity/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How framework:make:entity Compares

Feature / Agentframework:make:entityStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Génère une entité Doctrine avec repository selon principes Elegant Objects

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Framework Make Entity Skill

Génère une entité Doctrine complète avec son repository selon les principes Elegant Objects.

## Variables
- **{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)

## Outputs
- `src/Entity/{EntityName}.php`
- `src/Repository/{EntityName}Repository.php`
- `src/Repository/{EntityName}RepositoryInterface.php`

## Instructions à Exécuter

**IMPORTANT : Exécute ce workflow étape par étape :**

### 1. Demander le nom de l'entité

- Utilise AskUserQuestion pour demander :
  ```
  Question: "Quel est le nom de l'entité à créer ?"
  Header: "Entité"
  ```
- Valide que le nom est en PascalCase (première lettre majuscule)
- Stocke dans EntityName
- Génère entityName = EntityName en camelCase (première lettre minuscule)

### 2. Demander les propriétés de l'entité

- Utilise AskUserQuestion pour demander :
  ```
  Question: "Quelles sont les propriétés de l'entité ? Format: name:type,email:string,age:int"
  Header: "Propriétés"
  ```
- Parse la liste des propriétés
- Pour chaque propriété, extrais le nom et le type

### 3. Vérifier les contracts

- Exécute `ls src/Contracts/` avec Bash
- Si le répertoire n'existe pas :
  - Affiche : `⚠️  Contracts manquants - Génération automatique`
  - Utilise Skill pour appeler `framework:make:contracts`

### 4. Détecter le namespace du projet

- Lis `composer.json` avec Read
- Extrais le namespace depuis `autoload.psr-4`
- Si non trouvé, utilise `App` par défaut

### 5. Générer l'entité

- Créé le fichier `src/Entity/{EntityName}.php` avec Write
- Structure de classe :
  ```php
  namespace {namespace}\Entity;

  use Doctrine\ORM\Mapping as ORM;
  use {namespace}\Repository\{EntityName}Repository;

  #[ORM\Entity(repositoryClass: {EntityName}Repository::class)]
  final class {EntityName}
  {
      #[ORM\Id]
      #[ORM\Column(type: 'uuid', unique: true)]
      private string $id;

      // Propriétés générées depuis la liste

      private function __construct() {}

      public static function create({params}): self
      {
          $self = new self();
          $self->id = Uuid::v7();
          // Affectations des propriétés
          return $self;
      }

      // Getters pour chaque propriété
  }
  ```

### 6. Générer l'interface du repository

- Créé le fichier `src/Repository/{EntityName}RepositoryInterface.php` avec Write
- Contenu :
  ```php
  namespace {namespace}\Repository;

  interface {EntityName}RepositoryInterface
  {
      public function find(string $id): ?{EntityName};
      public function findAll(): array;
  }
  ```

### 7. Générer le repository

- Créé le fichier `src/Repository/{EntityName}Repository.php` avec Write
- Contenu :
  ```php
  namespace {namespace}\Repository;

  use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
  use Doctrine\Persistence\ManagerRegistry;
  use {namespace}\Entity\{EntityName};

  final class {EntityName}Repository extends ServiceEntityRepository implements {EntityName}RepositoryInterface
  {
      public function __construct(ManagerRegistry $registry)
      {
          parent::__construct($registry, {EntityName}::class);
      }
  }
  ```

### 8. Afficher le résumé

Affiche :
```
✅ Entité {EntityName} générée avec succès

Fichiers créés :
- src/Entity/{EntityName}.php
- src/Repository/{EntityName}Repository.php
- src/Repository/{EntityName}RepositoryInterface.php

Propriétés :
{liste des propriétés}

Prochaines étapes :
- Créer la migration : php bin/console make:migration
- Générer la factory : /framework:make:factory {EntityName}
- Générer la collection : /framework:make:collection {EntityName}
```

## Patterns appliqués

### Entité
- Classe `final`, constructeur privé, factory statique `create()`
- Traits : DatabaseTrait, NullTrait, DependencyInjectionTrait
- Interfaces : LoggableInterface, DatabaseEntityInterface, NullableInterface, DependencyInjectionAwareInterface, OutInterface, HasUrlsInterface, InvalideInterface

### Repository
- Classe `final`, extends ServiceEntityRepository
- Implémente interface du repository

## References

- [Usage](references/usage.md) - 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

Related Skills

symfony-framework

8
from atournayre/claude-marketplace

Comprehensive Symfony 6.4 development skill for web applications, APIs, and microservices.

symfony:make

8
from atournayre/claude-marketplace

Cherche si il existe un maker Symfony pour faire la tache demandée et l'utilise si il existe. Si aucun maker n'existe alors utilise la slash command "/prepare"

framework:make:urls

8
from atournayre/claude-marketplace

Génère classe Urls + Message CQRS + Handler

framework:make:story

8
from atournayre/claude-marketplace

Génère Story Foundry pour fixtures de tests

framework:make:out

8
from atournayre/claude-marketplace

Génère classe Out (DTO immuable pour output)

framework:make:invalide

8
from atournayre/claude-marketplace

Génère classe Invalide (exceptions métier)

framework:make:factory

8
from atournayre/claude-marketplace

Génère Factory Foundry pour tests

framework:make:contracts

8
from atournayre/claude-marketplace

Génère les interfaces de contrats pour une architecture Elegant Objects

framework:make:collection

8
from atournayre/claude-marketplace

Génère classe Collection typée avec traits Atournayre

framework:make:all

8
from atournayre/claude-marketplace

Génère tous les fichiers pour une entité complète (orchestrateur)

fix-grammar

8
from atournayre/claude-marketplace

Fix grammar and spelling errors in one or multiple files while preserving formatting

phpstan-resolver

8
from atournayre/claude-marketplace

Résout automatiquement les erreurs PHPStan en analysant et corrigeant les problèmes de types. Boucle jusqu'à zéro erreur ou stagnation.