Skip to content

Instantly share code, notes, and snippets.

@ostrolucky
Created July 20, 2018 08:15
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 ostrolucky/3f8804c10e9b08935d11889a69411ca0 to your computer and use it in GitHub Desktop.
Save ostrolucky/3f8804c10e9b08935d11889a69411ca0 to your computer and use it in GitHub Desktop.
Moneyphp embeddable
<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://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
<embeddable name="Money\Currency">
<field name="code" length="3" />
</embeddable>
</doctrine-mapping>
/**
* @var Money
* @ORM\Embedded(class="Money\Money")
*/
private $price;
<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://raw.github.com/doctrine/doctrine2/master/doctrine-mapping.xsd">
<embeddable name="Money\Money">
<field name="amount" type="bigint" />
<embedded name="currency" class="Money\Currency" />
</embeddable>
</doctrine-mapping>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment