The followings are the available columns in table 'player':
Inheritance: extends CActiveRecord
Example #1
0
 public function getAttributes($names = true)
 {
     $ret = parent::getAttributes($names);
     $ret['current_rank'] = $this->currentRank;
     $ret['s1_history'] = $this->getForm('2016s1');
     $ret['s2_history'] = $this->getForm('2016s2');
     return $ret;
 }
 function test_add_many_via_association()
 {
     PlayerRecord::finder()->deleteAll("player_id > ?", 3);
     SkillRecord::finder()->deleteAll("skill_id > ?", 3);
     $player = new PlayerRecord(array('age' => 37));
     $player->skills[] = new SkillRecord(array('name' => 'Bash'));
     $player->skills[] = new SkillRecord(array('name' => 'Jump'));
     $player->save();
     //test insert
     $player2 = PlayerRecord::finder()->withSkills()->findByAge(37);
     $this->assertNotNull($player2);
     $this->assertEquals(count($player2->skills), 2);
     $this->assertEquals($player2->skills[0]->name, 'Bash');
     $this->assertEquals($player2->skills[1]->name, 'Jump');
     //test update
     $player2->skills[1]->name = "Skip";
     $player2->skills[] = new SkillRecord(array('name' => 'Push'));
     $player2->save();
     $criteria = new TActiveRecordCriteria();
     $criteria->OrdersBy['name'] = 'asc';
     $player3 = PlayerRecord::finder()->withSkills($criteria)->findByAge(37);
     $this->assertNotNull($player3);
     $this->assertEquals(count($player3->skills), 3);
     $this->assertEquals($player3->skills[0]->name, 'Bash');
     $this->assertEquals($player3->skills[1]->name, 'Push');
     $this->assertEquals($player3->skills[2]->name, 'Skip');
     //test lazy load
     $player4 = PlayerRecord::finder()->findByAge(37);
     $this->assertEquals(count($player4->skills), 3);
     $this->assertEquals($player4->skills[0]->name, 'Bash');
     $this->assertEquals($player4->skills[1]->name, 'Skip');
     $this->assertEquals($player4->skills[2]->name, 'Push');
 }