コード例 #1
0
 public function extractTest()
 {
     $toJob = new JoinPart('j', Job::getPeer());
     $toPerson = new JoinPart('p', Person::getPeer());
     $toDepartment = new JoinPart('d', Department::getPeer());
     $toChief = new JoinPart('c', Person::getPeer());
     $toJob->addRelative($toPerson, 'JobPerson');
     $toPerson->addRelative($toDepartment, 'Department');
     $toDepartment->addRelative($toChief, 'DepartmentChief');
     $job = Job::getPeer()->objectFor(array('job_id' => '21', 'title' => 'clean the toilette', 'valid_from' => new \util\Date(), 'expire_at' => ''));
     $toPerson->extract($job, array('p_person_id' => '11', 'p_name' => 'Schultz', 'p_job_id' => '21', 'p_department_id' => '31', 'd_department_id' => '31', 'd_name' => 'iDev', 'd_chief_id' => '12', 'c_person_id' => '12', 'c_name' => 'Friebe', 'c_job_id' => '22', 'c_department_id' => '31'), 'JobPerson');
     $this->assertClass($job->getCachedObj('JobPerson', '#11'), 'net.xp_framework.unittest.rdbms.dataset.Person');
     $this->assertClass($job->getCachedObj('JobPerson', '#11')->getCachedObj('Department', '#31'), 'net.xp_framework.unittest.rdbms.dataset.Department');
     $this->assertClass($job->getCachedObj('JobPerson', '#11')->getCachedObj('Department', '#31')->getCachedObj('DepartmentChief', '#12'), 'net.xp_framework.unittest.rdbms.dataset.Person');
 }