public function testCreateAndRecall() { $factory = new Factory($this->mongator, $this->faker); $blueprint = new Blueprint($factory, 'Model\\Article', array('author', 'categories', 'source', 'comments' => 4, 'firstName' => 'MyName')); $document = $blueprint->create(); $this->assertInstanceOf('Model\\Article', $document); $blueprint->recall(); $result = $this->mongator->getRepository('Model\\Article')->createQuery()->criteria(array('_id' => $document->getId()))->one(); $this->assertTrue($result === null); }
public static function embedded(Factory $factory, $class, $value = null) { if (!$value) { $value = array(); } else { if ($value instanceof $class) { return $value->toArray(); } } $bp = new Blueprint($factory, $class); return $bp->build($value, false); }