/**
  * Does this object present the required methods to be automatically saved by RecordManager
  *
  * Is the object a Container and is it Normality::isCompatible()?
  *
  * @param mixed Object
  * @return array|null (booly)
  */
 public static function isCompatible($object, &$error = null)
 {
     if (!$object instanceof Container) {
         $error = 'Only Entity\\Containers are NormalityCollection compatible';
         return false;
     }
     // Pete. Humm. Not sure we even need this one. It probably is enough to be of the correct type.
     if ($firstElement = $object->firstElementGet()) {
         return parent::isCompatible($firstElement, $error);
     }
     return true;
 }
Example #2
0
 public function testTnit()
 {
     $a1r = $this->entityManager->getRepository('A1');
     $a2r = $this->entityManager->getRepository('A1');
     // init
     $a1 = $a1r->make();
     $a1Task = new Persist($this->entityManager->recordManager);
     $this->assertTrue($a1Task instanceof Normality);
     $this->assertTrue(Normality::isCompatible($a1));
     $this->assertTrue($a1Task->setObject($a1));
     $this->assertSame($a1Task->getObject(), $a1);
     $a2 = $a2r->make();
     $a2Task = new Persist($this->entityManager->recordManager);
     $this->assertTrue($a2Task instanceof Normality);
     $this->assertTrue(Normality::isCompatible($a2));
     $this->assertTrue($a2Task->setObject($a2));
     $this->assertSame($a2Task->getObject(), $a2);
 }