This repository has been archived by the owner on Apr 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #68 from dantleech/xml_reference
Added an XML reference
- Loading branch information
Showing
3 changed files
with
71 additions
and
4 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
4 changes: 2 additions & 2 deletions
4
en/reference/annotations-reference.rst → en/reference/annotations-mapping.rst
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,67 @@ | ||
XML Mapping | ||
=========== | ||
|
||
This chapter gives a brief overview of the XML mapping by example. In general, | ||
the attributes correspond to their annotation counterparts with the difference that | ||
the attribute names are slugified as opposed to being camelCase | ||
(``referring-document`` instead of ``referringDocument``). See :doc:`annotations-reference`. | ||
|
||
The following example implements all of the possible XML mapping elements: | ||
|
||
.. code-block:: xml | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd"> | ||
<document name="Acme\Document\Example" referenceable="true" translator="attribute" versionable="simple"> | ||
<!-- Identification --> | ||
<uuid name="uuid" /> | ||
<id name="path" /> | ||
<nodename name="name" /> | ||
<!-- Hierarchy --> | ||
<parent-document name="parent" /> | ||
<children name="children" /> | ||
<child name="block" node-name="block" /> | ||
<depth name="depth" /> | ||
<!-- PHPCR --> | ||
<node name="phpcrNode" /> | ||
<!-- Translation --> | ||
<locale name="locale" /> | ||
<!-- Field mappings --> | ||
<field name="title" type="string" translated="true" /> | ||
<field name="resourceLocator" property="resource-locator" type="string" translated="true" /> | ||
<field name="creator" type="long" translated="true" nullable="true" /> | ||
<!-- References --> | ||
<reference-one name="anyDocumentReference"/> | ||
<reference-one name="user" target-document="Acme\Document\User"/> | ||
<reference-many name="articles" target-document="Acme\Document\Article"/> | ||
<referrers name="tags" referring-document="Acme\Document\Tag" /> | ||
<mixed-referrers name="allReferrers" /> | ||
<!-- Versioning --> | ||
<version-name name="versionName" /> | ||
<version-created name="versionCreated" /> | ||
</document> | ||
</document> | ||
Mapped super-classes can be mapped as follows: | ||
|
||
.. code-block:: xml | ||
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd"> | ||
<mapped-superclass name="Acme\Document\Example" referenceable="true" translator="attribute" versionable="simple"> | ||
<!-- ... --> | ||
</mapped-superclass> | ||
</doctrine-mapping> |