coen-hyde / Shanty-Mongo

Shanty Mongo is a mongodb library for the Zend Framework. Its intention is to make working with mongodb documents as natural and as simple as possible. In particular allowing embedded documents to also have custom document classes.
Other
200 stars 52 forks source link

Pass $data to new() method #101

Open CrazyClicker opened 11 years ago

CrazyClicker commented 11 years ago

Hello there!

I just have a small question. I'm created a document and one of it's properties have a requirement such as:

'products' => 'DocumentSet', products.$' => array('Document:Model_Product'),

so as I understood from reading Shanty_Mongo_DocumentSet sources I simply cannot pass values to product when instantinating it like this:

$this->products->new(array('foo' => 'bar'));

So there is any reason for such behavior or it just not implemented yet?

coen-hyde commented 11 years ago

Hi,

You should be able to initialise a document set like that. It just hasn't been implemented. I'd welcome a pull request with tests.

Cheers, Coen