
上QQ阅读APP看书,第一时间看更新
Collection Serialized into a Single Column
Serializing a collection of Value Objects into a single column is most likely the easiest solution. Everything that was previously explained in the section about persisting a single Value Object applies in this situation. With Doctrine, you can use an Object or Custom Type — with some additional considerations to bear in mind: Value Objects should be small in size, but if you wish to persist a large collection, be sure to consider the maximum column length and the maximum row width that your database engine can handle.
Exercise
Come up with both Doctrine Object Type and Doctrine Custom Type implementation strategies for persisting a Product with different prices.
Come up with both Doctrine Object Type and Doctrine Custom Type implementation strategies for persisting a Product with different prices.