Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Symfony Entity Creator Bundle Laravel Package

dolmitos/symfony-entity-creator-bundle

View on GitHub
Deep Wiki
Context7

Getting Started

Minimal Setup

  1. Installation

    composer require dolmitos/symfony-entity-creator-bundle
    

    Ensure Dolmitos\EntityCreatorBundle\DolmitosEntityCreatorBundle::class is registered in config/bundles.php.

  2. Configuration Add to config/packages/dolmitos_entity_creator.yaml:

    dolmitos_entity_creator:
        entities:
            - App\Entity\YourEntity
        form_types:
            - App\Form\YourEntityType
    
  3. First Use Case Generate a form type for YourEntity via CLI:

    php bin/console make:entity-creator:form YourEntity
    

    This auto-generates a form class with default mappings for entity fields.


Implementation Patterns

Workflows

  1. Dynamic Form Generation Use the bundle to scaffold form types for entities without manual CRUD:

    // In a controller
    $form = $this->get('dolmitos_entity_creator.form_factory')->createForm(
        'YourEntityType',
        $entity
    );
    
  2. Custom Field Mapping Extend default behavior by overriding the form type:

    # config/packages/dolmitos_entity_creator.yaml
    dolmitos_entity_creator:
        form_types:
            - { class: App\Form\YourEntityType, options: { custom_option: true } }
    
  3. Integration with API Platform Combine with API Platform’s ApiResource to auto-generate forms for API endpoints:

    #[ApiResource(formType: 'YourEntityType')]
    class YourEntity {}
    
  4. Event-Driven Extensions Listen to entity_creator.form_build events to modify forms dynamically:

    // src/EventListener/FormModifier.php
    public function onFormBuild(FormEvent $event) {
        $event->getForm()->add('custom_field', TextType::class);
    }
    

Gotchas and Tips

Pitfalls

  1. Entity Reflection Caching Clear cache after adding new entities to dolmitos_entity_creator.yaml:

    php bin/console cache:clear
    
  2. Form Type Conflicts Avoid naming collisions with existing form types. Prefix custom types (e.g., App\Form\YourEntityAdminType).

  3. Doctrine Metadata Issues Ensure entities are properly mapped in Doctrine. The bundle relies on Doctrine’s metadata:

    php bin/console doctrine:mapping:info
    

Debugging

  • Verify Configuration Check if entities are registered in the bundle’s config. Use:

    php bin/console debug:config dolmitos_entity_creator
    
  • Form Dumping Dump form structure for debugging:

    $form->getConfig()->getDataClass(); // Check entity class
    dump($form->getConfig()->getOption('data_class'));
    

Extension Points

  1. Custom Field Types Override field types per entity via YAML:

    dolmitos_entity_creator:
        field_overrides:
            YourEntity:
                field_name: [App\Form\Type\CustomType, { option: value }]
    
  2. Validation Groups Pass validation groups dynamically:

    $form = $this->get('dolmitos_entity_creator.form_factory')->createForm(
        'YourEntityType',
        $entity,
        ['validation_groups' => ['group1', 'group2']]
    );
    
  3. Translation Support Use Symfony’s translation system for form labels/placeholders:

    # translations/messages.en.yaml
    'YourEntity.field_name': 'Custom Label'
    
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
coleus/frame
thtg88/journalism
filagora/filagora-ai-forums
rlacerda83/query-parser
socialdept/atp-orm
cboxdk/laravel-assistant-client
socialdept/atp-resolver
socialdept/tenant-domains
tautvydasr/blade-class-names
socialdept/color-scales
maherelgamil/controller
coleus/widgets
coleus/table
coleus/users
coleus/music
coleus/health
coleus/calendar
coleus/notes
coleus/support
coleus/settings