Beispiel #1
0
 public static function createHelper($alias, $identity, $powers = array())
 {
     $hero = new Hero(array('alias' => $alias));
     $hero->save();
     $identity = new SecretIdentity(array('realname' => $identity));
     $hero->SecretIdentity = $identity;
     $identity->save();
     foreach ($powers as $power) {
         $power = new Power(array('description' => $power));
         $hero->Powers[] = $power;
         $power->save();
     }
     $hero->save();
     return $hero;
 }
Beispiel #2
0
 public function testEmptyRelationshipsWithAllowEmpty()
 {
     $hero = new Hero(array('alias' => 'Spider Man'));
     $hero->save();
     $this->assertNull($hero->SecretIdentity);
 }