UnionOfRAD/lithium — pull request #467 by nealerickson (2012-05-19 00:43:04+00:00)
Title: Test case for bug in casting array of embedded documents

From the conversion I had with nate the other day on IRC this appears to be a bug.

I modified the testTypeCasting method and $_schema so that I could test the casting of arrays of embedded documents. The documents are being saved, however the values being saved to the db are not cast properly.

Ideally the following schema would allow me to properly cast an array of embedded documents at the accounts path.
```php
protected $_schema = array(
'_id' => array('type' => 'id'),
...
'accounts' => array('type' => 'object', 'array' => true),
'accounts._id' => array('type' => 'id'),
'accounts.name' => array('type' => 'string'),
'accounts.created' => array('type' => 'date'),
...
'notifications.baz' => array('type' => 'boolean')
);
```

However, when saving the following data the values in account arrays are not being properly cast. The _id fields remain strings while the created fields are numeric timestamps and not instances of MongoDate.
```php
$data = array(
'_id' => '4c8f86167675abfabd970300',
...
'accounts' => array(array(
'_id' => "4fb6e2dd3e91581fe6e75736",
'name' => 'Foo',
'created' => time()
),array(
'_id' => "4fb6e2df3e91581fe6e75737",
'name' => 'Bar',
'created' => time()
)
),
'empty_array' => array(),
'authors' => '4c8f86167675abfabdb00300',
...
'rank' => '3.45688'
);
```