Skip to content

Commit

Permalink
Merge pull request #11 from yceruto/amount_mapping
Browse files Browse the repository at this point in the history
Persist Money amount field as integer
  • Loading branch information
yceruto committed Jan 30, 2023
2 parents 68666d2 + 35ad706 commit 5fad0ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion config/doctrine/mapping/Money.orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
https://www.doctrine-project.org/schemas/orm/doctrine-mapping.xsd">

<embeddable name="Money\Money">
<field name="amount" />
<field name="amount" type="integer" />
<embedded name="currency" class="Money\Currency" use-column-prefix="false" />
</embeddable>
</doctrine-mapping>
2 changes: 1 addition & 1 deletion tests/DependencyInjection/MoneyExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function testMoneyDoctrineMapping(): void
self::assertTrue($metadata->isEmbeddedClass);
self::assertSame(Money::class, $metadata->getName());
self::assertSame(['amount', 'currency.code'], $metadata->getFieldNames());
self::assertSame('string', $metadata->getTypeOfField('amount'));
self::assertSame('integer', $metadata->getTypeOfField('amount'));
self::assertSame('string', $metadata->getTypeOfField('currency.code'));
self::assertCount(1, $metadata->embeddedClasses);
self::assertSame(Currency::class, $metadata->embeddedClasses['currency']['class']);
Expand Down
1 change: 0 additions & 1 deletion tests/Model/MoneyDtoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

namespace Yceruto\MoneyBundle\Tests\Model;

use AssertionError;
use Money\Money;
use PHPUnit\Framework\TestCase;
use Throwable;
Expand Down

0 comments on commit 5fad0ce

Please sign in to comment.