Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boshurik/doctrine-mongodb-odm-money
Doctrine ODM Money Type Integration
https://github.com/boshurik/doctrine-mongodb-odm-money
doctrine-odm doctrine-odm-mongodb money
Last synced: about 2 months ago
JSON representation
Doctrine ODM Money Type Integration
- Host: GitHub
- URL: https://github.com/boshurik/doctrine-mongodb-odm-money
- Owner: BoShurik
- Created: 2019-01-11T08:49:48.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-15T15:35:59.000Z (over 4 years ago)
- Last Synced: 2024-10-12T23:11:08.764Z (3 months ago)
- Topics: doctrine-odm, doctrine-odm-mongodb, money
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Doctrine ODM Money Type Integration
Use [`michaelgooden/mdg-money-doctrine`](https://github.com/MichaelGooden/mdg-money-doctrine) for ORM inegration
## Installation
Add `vendor/boshurik/doctrine-mongodb-odm-money/config/Money.mongodb.xml` to mapping
```php
Doctrine\ODM\MongoDB\Types\TypeType::registerType('currency', \BoShurik\Money\Doctrine\ODM\MongoDB\Types\CurrencyType::class);
```### Symfony integration
- Add CurrencyType (e.g. in `Kernel.php`)
```phpuse BoShurik\Money\Doctrine\ODM\MongoDB\Types\CurrencyType;
class Kernel extends BaseKernel
{
public function __construct(string $environment, bool $debug)
{
parent::__construct($environment, $debug);
Type::addType('currency', CurrencyType::class);
}
// ...
}
```- Add mapping to `config/packages/doctrine_mongodb.yaml`
```yaml
doctrine_mongodb:
document_managers:
default:
mappings:
Money:
is_bundle: false
type: xml
dir: '%kernel.project_dir%/vendor/boshurik/doctrine-mongodb-odm-money/config'
prefix: Money
```