daniellehrner/meat-up
Symfony bundle that generates a full CRUD scaffold from a Doctrine entity. Provides a console command to create a controller, FormType, and Twig views (index table plus create/edit pages), based on a Symfony Skeleton starting point.
Installation:
composer require daniellehrner/meat-up
Ensure your project uses Symfony 2.8 and the interpunkt skeleton.
First Use Case:
Generate a CRUD controller for an existing Doctrine entity (e.g., App\Entity\Post):
php app/console ip:meat-up "App\Entity\Post"
This creates:
FormType (e.g., PostType.php).Controller (e.g., PostController.php).index, show, new, and edit actions.Where to Look First:
Resources/doc/index.md for supported annotations (e.g., @MU\OnIndexPage, @MU\Hidden).src/[Bundle]/Controller/ and src/[Bundle]/Resources/views/.php app/console ip:meat-up --help
Entity-First Development:
@MU\OnIndexPage for table columns).ip:meat-up to auto-generate CRUD scaffolding./**
* @ORM\Column(type="string")
* @MU\OnIndexPage(label="Post Title", filter="upper")
*/
private $title;
Form Customization:
@MU\Hidden to exclude fields.@MU\CKEditor for rich-text fields.@MU\VichUploadable for file uploads.FormType classes in src/[Bundle]/Form/ if needed.Relationships:
ManyToOne, use @MU\ManyToOneOrderBy to sort related entities:
/**
* @MU\ManyToOneOrderBy("name")
*/
private $author;
Twig Overrides:
src/[Bundle]/Resources/views/Override/ and modifying them.Command Options:
php app/console ip:meat-up "App\Entity\Post" --force
routing.yml includes the generated controller paths (e.g., /admin/post).{% block stylesheets %} and {% block javascripts %} in Twig templates to add bundle-specific assets.@Assert\NotBlank) to entity properties for automatic form validation.EntityManager, FormFactory).Lock File Conflicts:
.meatup.lock file to prevent concurrent generation. Delete it manually if stuck:
rm src/[Bundle]/Resources/.meatup.lock
--force to bypass locks (not recommended for shared environments).Annotation Namespace:
use Ip\MeatUp\Mapping as MU;
Symfony Version Mismatch:
Doctrine Schema Updates:
doctrine:schema:update after generating entities to avoid "class not found" errors in the generated CRUD.CKEditor/VichUploader Dependencies:
IvoryCKEditorBundle and VichUploaderBundle are installed if using their annotations:
composer require ivory/ckeditor-bundle vich/uploader-bundle
src/[Bundle]/Controller/).php app/console cache:clear
var_dump() in the entity to confirm annotations are loaded (e.g., @MU\OnIndexPage).-v for verbose logs:
php app/console ip:meat-up "App\Entity\Post" -v
Custom Templates:
src/[Bundle]/Resources/views/Override/.index.html.twig to customize the table layout.Annotation Extensions:
src/[Bundle]/DependencyInjection/ and updating the generator service.Post-Generation Hooks:
kernel.request event to modify generated controllers dynamically (e.g., inject services).Form Events:
FORM_PRE_SET_DATA or FORM_POST_SET_DATA in your bundle to alter form behavior:
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
// Modify form dynamically
});
FormType or Controller by deleting specific files and re-running the command..gitignore if they’re environment-specific:
/src/[Bundle]/Controller/Generated*
/src/[Bundle]/Resources/views/Generated*
How can I help you explore Laravel packages today?