-
-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ResolveTargetEntity mapping file support. Refactored Doctrine config.
- Loading branch information
Showing
6 changed files
with
54 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ with Doctrine Resolve Target Entity Listener option). | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
namespaces: | ||
entity: "Dunglas\EcommerceBundle\Entity" | ||
enum: "Dunglas\EcommerceBundle\Enum" | ||
|
@@ -20,7 +20,7 @@ Namespaces can also be specified for a specific type. It will take precedence ov | |
Example: | ||
```yml | ||
```yaml | ||
types: | ||
Thing: | ||
namespaces: | ||
|
@@ -37,7 +37,7 @@ Schema.org definition). | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
types: | ||
Brand: | ||
properties: | ||
|
@@ -61,7 +61,7 @@ Cardinalities are enforced by the class generator, the Doctrine ORM generator an | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
types: | ||
Product: | ||
properties: | ||
|
@@ -75,7 +75,7 @@ Override the guessed class hierarchy of a given type with this option. | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
ImageObject: | ||
parent: Thing # Force the parent to be Thing instead of CreativeWork > MediaObject | ||
properties: ~ | ||
|
@@ -89,7 +89,7 @@ Add a `@author` PHPDoc annotation to class' DocBlock. | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
author: "Kévin Dunglas <[email protected]>" | ||
``` | ||
|
||
|
@@ -99,7 +99,7 @@ By default, all generators are enabled. You can specify the list of generators t | |
|
||
Example (enabling only the PHPDoc generator): | ||
|
||
```yml | ||
```yaml | ||
annotationGenerators: | ||
- SchemaOrgModel\AnnotationGenerator\PhpDocAnnotationGenerator | ||
``` | ||
|
@@ -110,7 +110,7 @@ useful when creating your own generators. | |
|
||
Enabling a custom generator and the PHPDoc generator: | ||
|
||
```yml | ||
```yaml | ||
annotationGenerators: | ||
- SchemaOrgModel\AnnotationGenerator\PhpDocAnnotationGenerator | ||
- Acme\Generators\MyGenerator | ||
|
@@ -122,7 +122,7 @@ By default, the generator add a property called `id` not provided by Schema.org. | |
with an ORM or an ODM. | ||
This behavior can be disabled with the following setting: | ||
|
||
```yml | ||
```yaml | ||
generateId: false | ||
``` | ||
|
||
|
@@ -132,8 +132,9 @@ By default, the generator use classes provided by the [Doctrine Collections](htt | |
to store collections of entities. This is useful (and required) when using Doctrine ORM or Doctrine ODM. | ||
This behavior can be disabled (to fallback to standard arrays) with the following setting: | ||
|
||
```yml | ||
useDoctrineCollection: false | ||
```yaml | ||
doctrine: | ||
useCollection: false | ||
``` | ||
|
||
## Custom field visibility | ||
|
@@ -143,7 +144,7 @@ The default visibility can be changed with the `fieldVisibility` otion. | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
fieldVisibility: "protected" | ||
``` | ||
|
||
|
@@ -154,7 +155,7 @@ The standard behavior of the generator is to use the `@MappedSuperclass` Doctrin | |
|
||
The inheritance annotation can be forced for a given type like the following: | ||
|
||
```yml | ||
```yaml | ||
types: | ||
Product: | ||
doctrine: | ||
|
@@ -172,6 +173,12 @@ mappings. | |
If you set the option `useInterface` to true, the generator will generate an interface corresponding to each generated | ||
entity and will use them in relation mappings. | ||
|
||
To let PHP Schema generating the XML mapping file usable with Symfony add the following to your config file: | ||
|
||
```yaml | ||
doctrine: | ||
resolveTargetEntityConfigPath: path/to/doctrine.xml | ||
``` | ||
|
||
## Custom schemas | ||
|
||
|
@@ -181,7 +188,7 @@ to generate the PHP data model of your application. | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
rdfa: | ||
- https://raw.githubusercontent.com/rvguha/schemaorg/master/data/schema.rdfa # Experimental version of Schema.org | ||
- http://example.com/data/myschema.rfa # Additional types | ||
|
@@ -202,7 +209,7 @@ Prepend all generated PHP files with a custom comment. | |
|
||
Example: | ||
|
||
```yml | ||
```yaml | ||
header: | | ||
/* | ||
* This file is part of the Ecommerce package. | ||
|
@@ -222,7 +229,7 @@ header: | | |
rdfa: | ||
# Default: | ||
- https://raw.githubusercontent.com/rvguha/schemaorg/master/data/schema.rdfa | ||
- http://schema.org/docs/schema_org_rdfa.html | ||
# OWL relation files to use | ||
relations: | ||
|
@@ -239,9 +246,6 @@ generateId: true | |
# Generate interfaces and use Doctrine's Resolve Target Entity feature | ||
useInterface: false | ||
# Use Doctrine's ArrayCollection instead of standard arrays | ||
useDoctrineCollection: true | ||
# Emit a warning if a property is not derived from GoodRelations | ||
checkIsGoodRelations: false | ||
|
@@ -260,6 +264,15 @@ namespaces: | |
# The namespace of the generated interfaces | ||
interface: SchemaOrg\Model # Example: Acme\Model | ||
# Doctrine | ||
doctrine: | ||
# Use Doctrine's ArrayCollection instead of standard arrays | ||
useCollection: true | ||
# The Resolve Target Entity Listener config file pass | ||
resolveTargetEntityConfigPath: null | ||
# The value of the phpDoc's @author annotation | ||
author: false # Example: Kévin Dunglas <[email protected]> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<container xmlns="http://symfony.com/schema/dic/services" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:doctrine="http://symfony.com/schema/dic/doctrine" | ||
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd | ||
http://symfony.com/schema/dic/doctrine http://symfony.com/schema/dic/doctrine/doctrine-1.0.xsd"> | ||
<doctrine:config> | ||
<doctrine:orm> | ||
{% for interface, class in mappings %} | ||
<doctrine:resolve-target-entity interface="{{ interface }}">{{ class }}</doctrine:resolve-target-entity> | ||
{% endfor %} | ||
</doctrine:orm> | ||
</doctrine:config> | ||
</container> |