quantic-telecom / invoices-storage
此包已被废弃,不再维护。未建议替代包。
轻松管理您的发票存储
2.0.0
2016-01-26 13:38 UTC
Requires
- php: >=5.6.0
- ext-mongodb: ~1.1
- mongodb/mongodb: ^1.0
- quantic-telecom/invoices: ~2.0
- quantic-telecom/storage: ~2.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ~5.0
- squizlabs/php_codesniffer: ~2.0
This package is auto-updated.
Last update: 2022-02-01 12:47:37 UTC
README
此包为您提供轻松存储发票的方式。
安装
通常,通过Composer安装Invoices Storage。
"require": { "quantic-telecom/invoices-storage": "~1.0" }
合约
仓库
InvoiceRepositoryInterface
提供了获取(get
和getAll
)和保存(save
)发票的方法签名。
工厂
此包需要大量工厂来从数据库中存储的数据创建发票。
CustomerFactoryInterface
PaymentFactoryInterface
ItemFactoryInterface
GroupOfItemsFactoryInterface
InvoiceFactoryInterface
所有这些工厂都具有build
和inverseResolution
方法。
反向解析
反向解析的工作方式类似于DNS。仓库需要知道它需要实例化哪个具体的类。必须使用inverseResolution
方法返回一个字符串(类名的域名),该字符串将与对象数据一起存储。当仓库需要获取此对象时,它将传递给build
方法的该字符串和数据。然后,工厂需要知道如何构建请求的对象并返回它。
实现
仓库
此包为InvoiceRepositoryInterface
提供了名为InvoiceMongoRepository
的MongoDB实现。此仓库不使用任何ORM,并自行构建MongoDB查询。
工厂
每个工厂实现构建并解析一个或多个具体的类。
没有为CustomerFactoryInterface
和PaymentFactoryInterface
提供实现,因为quantic-telecom/invoices
没有为CustomerInterface
和PaymentInterface
提供任何具体的类。客户端需要实现这些工厂,因为它们由InvoiceFactory
需要。
InvoiceFactory
具体类 | 类域名 |
---|---|
QuanticTelecom\Invoices\ExcludingTaxInvoice |
includingTaxInvoice |
QuanticTelecom\Invoices\IncludingTaxInvoice |
excludingTaxInvoice |
ItemFactory
具体类 | 类域名 |
---|---|
QuanticTelecom\Invoices\Item |
item |
GroupOfItemsFactory
具体类 | 类域名 |
---|---|
QuanticTelecom\Invoices\GroupOfItems |
groupOfItems |