You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A property can be marked read only with the following configuration:
188
+
189
+
```yaml
190
+
Person:
191
+
properties:
192
+
email: { writable: false }
193
+
```
194
+
195
+
In such case, no mutator method will be generated.
196
+
197
+
## Making a Property Write Only
198
+
199
+
A property can be marked read only with the following configuration:
200
+
201
+
```yaml
202
+
Person:
203
+
properties:
204
+
email: { radable: false }
205
+
```
206
+
207
+
In this case, no getter method will be generated.
208
+
185
209
## Forcing a Property to be in a Serialization Group
186
210
187
211
Force a property to be in a `groups`.
@@ -281,13 +305,57 @@ annotationGenerators:
281
305
- Acme\Generators\MyGenerator
282
306
```
283
307
284
-
## Disabling `id` Generator
308
+
## Skipping Accessor Method Generation
309
+
310
+
It's possible to skip the generation of accessor methods. This is particularly useful combined with the `visibility: public`
311
+
option.
312
+
313
+
To skip the generation of accessor methods, use the following config:
314
+
315
+
```yaml
316
+
accessorMethods: false
317
+
```
285
318
286
-
By default, the generator adds a property called `id` not provided by Schema.org. This may be useful when generating an entity for use with an ORM or an ODM.
319
+
It's possible to skip
320
+
321
+
## Disabling the `id` Generator
322
+
323
+
By default, the generator adds a property called `id` not provided by Schema.org.
324
+
This is useful when generating an entity for use with an ORM or an ODM but not when generating DTOs.
287
325
This behavior can be disabled with the following setting:
288
326
289
327
```yaml
290
-
generateId: false
328
+
id:
329
+
generate: false
330
+
```
331
+
332
+
## Generating UUIDs
333
+
334
+
It's also possible to let the DBMS generate [UUIDs](https://en.wikipedia.org/wiki/Universally_unique_identifier) instead of autoincremented integers:
335
+
336
+
```yaml
337
+
id:
338
+
generationStrategy: uuid
339
+
```
340
+
341
+
## User submitted UUIDs
342
+
343
+
To set manually a UUID instead of letting the DBMS generating it, use the following config:
344
+
345
+
```yaml
346
+
id:
347
+
generationStrategy: uuid
348
+
writable: true
349
+
```
350
+
351
+
## Generating Custom IDs
352
+
353
+
With this configuration option, an `$id` property of type `string` and the corresponding getters and setters will be
354
+
generated, but the DBMS will not generate anything, the ID must be set manually.
355
+
356
+
```yaml
357
+
id:
358
+
generationStrategy: none
291
359
```
292
360
293
361
## Disabling Usage of Doctrine Collection
@@ -301,7 +369,7 @@ doctrine:
301
369
useCollection: false
302
370
```
303
371
304
-
## Custom Field Visibility
372
+
## Changing the Field Visibility
305
373
306
374
Generated fields have a `private` visibility and are exposed through getters and setters.
307
375
The default visibility can be changed with the `fieldVisibility` otion.
@@ -312,6 +380,15 @@ Example:
312
380
fieldVisibility: "protected"
313
381
```
314
382
383
+
## Generating `@Assert\Type` Annotations
384
+
385
+
It's possible to automatically generate Symfony validator's `@Assert\Type` annotations using the following config:
0 commit comments