public function setUp() { parent::setUp(); $migrator = new \Pheasant\Migrate\Migrator(); $migrator->create('user', User::schema())->create('userpref', UserPref::schema()); // create some users $this->users = User::import(array(array('firstname' => 'Frank', 'lastname' => 'Castle'), array('firstname' => 'Cletus', 'lastname' => 'Kasady'))); // create some user prefs $this->userprefs = UserPref::import(array(array('User' => $this->users[0], 'pref' => 'autologin', 'value' => 'yes'), array('User' => $this->users[1], 'pref' => 'autologin', 'value' => 'no'))); $this->assertTrue($this->userprefs[0]->User->equals($this->users[0])); $this->assertTrue($this->userprefs[1]->User->equals($this->users[1])); }
public function relationships() { return array('UserPrefs' => UserPref::hasMany('userid')); }