Skip to content

Commit 38278bd

Browse files
authored
Merge pull request #511 from ErikSaunier/2.2
Add exemple for feature api-platform/schema-generator#132
2 parents 995c13b + 94b8848 commit 38278bd

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

schema-generator/configuration.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,44 @@ Example:
274274
coordinates: { range: "GeoCoordinates", embedded: true, columnPrefix: false }
275275
```
276276

277+
or
278+
279+
```yaml
280+
QuantitativeValue:
281+
embeddable: true
282+
Product:
283+
weight: { range: "QuantitativeValue", embedded: true, columnPrefix: "weight_" }
284+
```
285+
286+
Output:
287+
288+
```php
289+
<?php
290+
291+
...
292+
use Doctrine\ORM\Mapping as ORM;
293+
294+
/**
295+
* Any offered product or service.
296+
*
297+
* @see http://schema.org/Product Documentation on Schema.org
298+
*
299+
* @ORM\Entity
300+
* @ApiResource(iri="http://schema.org/Product")
301+
* @UniqueEntity("gtin13s")
302+
*/
303+
class Product
304+
{
305+
/**
306+
* @var QuantitativeValue|null the weight of the product or person
307+
*
308+
* @ORM\Embedded(class="App\Entity\QuantitativeValue", columnPrefix="weight_")
309+
* @ApiProperty(iri="http://schema.org/weight")
310+
*/
311+
private $weight;
312+
313+
```
314+
277315
## Author PHPDoc
278316

279317
Add a `@author` PHPDoc annotation to class' DocBlock.
@@ -635,7 +673,7 @@ config:
635673
embedded: false
636674
637675
# The property columnPrefix
638-
columnPrefix: false
676+
columnPrefix: false # Example: "weight_"
639677
640678
# Annotation generators to use
641679
annotationGenerators:

0 commit comments

Comments
 (0)