chriskite / phactory

A Database Factory for PHP Unit Tests
http://phactory.org
MIT License
140 stars 39 forks source link

should be able to associate an array of objects when creating with a manyToMany association #2

Closed chriskite closed 13 years ago

chriskite commented 13 years ago

For example, this should work:

Phactory::define('tag');

Phactory::define('post',
                 array('name' => 'Test Blog Post'),
                 array('tag' => Phactory::manyToMany('tag', 'posts_tags')));

$tag1 = Phactory::create('tag', array('name' => 'PHP'));
$tag1 = Phactory::create('tag', array('name' => 'Testing'));

$post = Phactory::createWithAssociations('post', array('tag' => array($tag1, $tag2)));

Existing functionality should be retained for backwards-compatibility.