Inheritance: extends Pheasant\DomainObject
Esempio n. 1
0
 public function testPropertyReferencesResolvedInMapping()
 {
     $identity = new SecretIdentity(array('realname' => 'Peter Parker'));
     $hero = new Hero(array('alias' => 'Spider Man'));
     // set the identityid before it's been saved, still null
     $hero->identityid = $identity->id;
     $identity->save();
     $hero->save();
     $this->assertEquals($identity->id, 1);
     $this->assertEquals($hero->identityid, 1);
 }
Esempio n. 2
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;
 }
Esempio n. 3
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('hero', Hero::schema())->create('power', Power::schema())->create('secretidentity', SecretIdentity::schema());
     $this->spiderman = Hero::createHelper('Spider Man', 'Peter Parker', array('Super-human Strength', 'Spider Senses'));
     $this->superman = Hero::createHelper('Super Man', 'Clark Kent', array('Super-human Strength', 'Invulnerability'));
     $this->batman = Hero::createHelper('Batman', 'Bruce Wayne', array('Richness', 'Super-human Intellect'));
 }
Esempio n. 4
0
 public function setUp()
 {
     parent::setUp();
     $migrator = new \Pheasant\Migrate\Migrator();
     $migrator->create('hero', Hero::schema())->create('power', Power::schema())->create('secretidentity', SecretIdentity::schema());
     $this->pheasant->connection()->execute('INSERT INTO sequences (name, id) VALUES (?, ?)', array('SECRETIDENTITY_ID_SEQ', 100));
     $spiderman = Hero::createHelper('Spider Man', 'Peter Parker', array('Super-human Strength', 'Spider Senses'));
     $superman = Hero::createHelper('Super Man', 'Clark Kent', array('Super-human Strength', 'Invulnerability'));
     $batman = Hero::createHelper('Batman', 'Bruce Wayne', array('Richness', 'Super-human Intellect'));
 }