Skip to content

Instantly share code, notes, and snippets.

@athlan
Last active May 8, 2019 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save athlan/cf9b6d388f9beb808e953ccf8533c56e to your computer and use it in GitHub Desktop.
Save athlan/cf9b6d388f9beb808e953ccf8533c56e to your computer and use it in GitHub Desktop.
moneyphp/money Doctrine mapping
doctrine:
orm:
mappings:
Money:
type: xml
dir: '%kernel.project_dir%/PATH_TO_MAPPING'
prefix: 'Money'
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Money\Money">
<field name="amount" column="amount" type="bigint" />
<embedded name="currency" class="Money\Currency" use-column-prefix="false" />
</embeddable>
</doctrine-mapping>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
<embeddable name="Money\Currency">
<field name="code" column="currency" type="string" length="3" />
</embeddable>
</doctrine-mapping>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment