|
1 | | -YEntityGeneratorBundle |
2 | | -====================== |
| 1 | +# YEntityGeneratorBundle |
3 | 2 |
|
4 | | -YEntityGeneratorBundle automatically creates entities from configurations |
| 3 | +YEntityGeneratorBundle automatically makes entities from configurations |
5 | 4 | for your Symfony applications with unprecedented simplicity. |
6 | 5 |
|
7 | | -**Attention:** This bundle isn't stable yet! Only use it for development purposes. |
| 6 | +## What does this bundle? |
8 | 7 |
|
9 | | -TODO |
| 8 | +### Step 1: Configure your entities |
10 | 9 |
|
11 | | -TODO: implement base entities and base repositories |
| 10 | +`./config/uay_entities.yaml` |
| 11 | +```yaml |
| 12 | +uay_entities: |
| 13 | + entities: |
| 14 | + Author: |
| 15 | + name: |
| 16 | + type: string |
| 17 | + length: 100 |
| 18 | + pages: |
| 19 | + relation: many |
| 20 | + target: Page |
| 21 | + role: |
| 22 | + type: enum |
| 23 | + target: Role |
| 24 | + Page: |
| 25 | + title: |
| 26 | + type: string |
| 27 | + length: 100 |
| 28 | + description: |
| 29 | + type: string |
| 30 | + length: 255 |
| 31 | + sample: |
| 32 | + type: string |
| 33 | + length: 255 |
| 34 | + nullable: true |
| 35 | + author: |
| 36 | + relation: one |
| 37 | + target: Author |
| 38 | + Role: |
| 39 | + Unknown: 1 |
| 40 | + Guest: 2 |
| 41 | + Member: 3 |
| 42 | + Assistant: 4 |
| 43 | + Admin: 5 |
| 44 | + Owner: 6 |
| 45 | +``` |
12 | 46 |
|
13 | | -TODO |
| 47 | +### Step 2: Call the console command |
14 | 48 |
|
15 | | -License |
16 | | -------- |
| 49 | +``` |
| 50 | +php bin/console entities:generate |
| 51 | +``` |
| 52 | + |
| 53 | +### Step 3: Update the database schema |
| 54 | + |
| 55 | +**Attention**: Be careful with this step! |
| 56 | + |
| 57 | +``` |
| 58 | +php bin/console doctrine:schema:update --force |
| 59 | +``` |
| 60 | + |
| 61 | +### Step 4: Done |
| 62 | + |
| 63 | +Generated UML-diagram `./readme/entities.png`: |
| 64 | + |
| 65 | + |
| 66 | + |
| 67 | +You will now find the configurated entities and files: |
| 68 | + |
| 69 | +``` |
| 70 | +. |
| 71 | +├── ... |
| 72 | +├── entities |
| 73 | +│ ├── entities.png |
| 74 | +│ └── entities.txt |
| 75 | +├── src |
| 76 | +│ ├── ... |
| 77 | +│ ├── Entity |
| 78 | +│ │ ├── ... |
| 79 | +│ │ ├── Generated |
| 80 | +│ │ │ ├── AuthorGenerated.php |
| 81 | +│ │ │ └── PageGenerated.php |
| 82 | +│ │ ├── Author.php |
| 83 | +│ │ ├── Page.php |
| 84 | +│ │ └── ... |
| 85 | +│ ├── Enum |
| 86 | +│ │ ├── ... |
| 87 | +│ │ ├── Role.php |
| 88 | +│ │ └── ... |
| 89 | +│ ├── Repository |
| 90 | +│ │ ├── ... |
| 91 | +│ │ ├── AuthorRepository.php |
| 92 | +│ │ ├── PageRepository.php |
| 93 | +│ │ └── ... |
| 94 | +│ └── ... |
| 95 | +└── ... |
| 96 | +``` |
| 97 | + |
| 98 | +## Usage |
| 99 | + |
| 100 | +Call `php bin/console entities:generate` to generate the entities from `uay_entities.yaml`. |
| 101 | + |
| 102 | +## Installation |
| 103 | + |
| 104 | +Add the repository: |
| 105 | +```json |
| 106 | + "repositories": [ |
| 107 | + // ... |
| 108 | + { |
| 109 | + "type": "vcs", |
| 110 | + "url": "https://github.com/uay/YEntityGeneratorBundle" |
| 111 | + }, |
| 112 | + // ... |
| 113 | + ], |
| 114 | +``` |
| 115 | + |
| 116 | +And add the package to `require-dev` and replace `<version>` with the current version: |
| 117 | +```json |
| 118 | + "require-dev": { |
| 119 | + // ... |
| 120 | + "uay/y-entity-generator-bundle": "<version>", |
| 121 | + // ... |
| 122 | + }, |
| 123 | +``` |
| 124 | + |
| 125 | + |
| 126 | +## Features |
| 127 | + |
| 128 | +- [x] Generate base entities |
| 129 | +- [x] Generate app entities |
| 130 | +- [x] Generate app repositories |
| 131 | +- [x] Generate app enums |
| 132 | +- [x] Configure generated names |
| 133 | +- [ ] Better UML configuration |
| 134 | +- [ ] Recursive namespace configurations |
| 135 | +- [ ] Config validation |
| 136 | +- [ ] Generate base repositories |
| 137 | +- [ ] Generate base enums |
| 138 | +- [ ] Allow to generate app entities only |
| 139 | +- [ ] ... we're open for inspiration |
| 140 | + |
| 141 | +If you want to see some of the features, you should not wait for them. |
| 142 | +There is no guarantee that we will implement the missing features. |
| 143 | +Instead you would better start contributing to this repository and implement them by yourself. |
| 144 | + |
| 145 | +## Versioning |
| 146 | + |
| 147 | +`x.y.z` |
| 148 | + |
| 149 | +- `x`: **Major**-Version: Breaking changes |
| 150 | +- `y`: **Minor**-Version: Additional features (non-breaking) |
| 151 | +- `z`: **Patch**-Version: Bugfixes and code improvements (non-breaking) |
| 152 | + |
| 153 | +## License |
17 | 154 |
|
18 | 155 | This software is published under the [MIT License](LICENSE.md) |
0 commit comments