YEntityGeneratorBundle automatically makes entities from configurations for your Symfony applications with unprecedented simplicity.
./config/services.yaml
imports:
- { resource: 'uay_entities.yaml' }
./config/uay_entities.yaml
uay_entities:
entities:
Author:
name:
type: string
length: 100
pages:
relation: many
target: Page
role:
type: enum
target: Role
Page:
title:
type: string
length: 100
description:
type: string
length: 255
sample:
type: string
length: 255
nullable: true
author:
relation: one
target: Author
Role:
Unknown: 1
Guest: 2
Member: 3
Assistant: 4
Admin: 5
Owner: 6
php bin/console entities:generate
Attention: Be careful with this step!
php bin/console doctrine:schema:update --force
Generated UML-diagram ./readme/entities.png
:
You will now find the configurated entities and files:
.
├── ...
├── entities
│ ├── entities.png
│ └── entities.txt
├── src
│ ├── ...
│ ├── Entity
│ │ ├── ...
│ │ ├── Generated
│ │ │ ├── AuthorGenerated.php
│ │ │ └── PageGenerated.php
│ │ ├── Author.php
│ │ ├── Page.php
│ │ └── ...
│ ├── Enum
│ │ ├── ...
│ │ ├── Role.php
│ │ └── ...
│ ├── Repository
│ │ ├── ...
│ │ ├── AuthorRepository.php
│ │ ├── PageRepository.php
│ │ └── ...
│ └── ...
└── ...
Call php bin/console entities:generate
to generate the entities from uay_entities.yaml
.
Add the repository (to the composer.json
file):
{
"repositories": [
{
"type": "vcs",
"url": "https://github.com/uay/YEntityGeneratorBundle"
}
]
}
And add the package to require-dev
and replace <version>
with the current version:
{
"require-dev": {
"uay/y-entity-generator-bundle": "<version>",
}
}
uay_entities:
imports: # Define your entity imports
Assert: 'Symfony\Component\Validator\Constraints'
# ...
entities: # Define your entities here like in the example above
# ...
uml: # Define your uml settings here
valid: false # By default the generated uml is not valid, change this here
namespace: # Define your namespace settings here
app: App
base: Generated
enum: Enum
entity: Entity
repository: Repository
classPostfix: # Define your class postfixes here
entity: Generated
repository: Repository
fixtures: # Define your doctrine fixtures data here
# ...
# ATTENTION: This is not implemented yet!
- Generate base entities
- Generate app entities
- Generate app repositories
- Generate app enums
- Configure generated names
- Better UML configuration
- Recursive namespace configurations
- Config validation
- Generate base repositories
- Generate base enums
- Allow to generate app entities only
- ... we're open for inspiration
If you want to see some of the features, you should not wait for them. There is no guarantee that we will implement the missing features. Instead you would better start contributing to this repository and implement them by yourself.
x.y.z
x
: Major-Version: Breaking changesy
: Minor-Version: Additional features (non-breaking)z
: Patch-Version: Bugfixes and code improvements (non-breaking)
This software is published under the MIT License