本文整理汇总了PHP中Job::getPeer方法的典型用法代码示例。如果您正苦于以下问题:PHP Job::getPeer方法的具体用法?PHP Job::getPeer怎么用?PHP Job::getPeer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Job
的用法示例。
在下文中一共展示了Job::getPeer方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getConnection
public function getConnection()
{
$q = new SelectQuery();
$this->assertNull($q->getConnection());
$q->setPeer(Job::getPeer());
$this->assertClass($q->getConnection(), 'net.xp_framework.unittest.rdbms.mock.MockConnection');
}
示例2: setUp
/**
* Sets up a Database Object for the test
*
*/
public function setUp()
{
$this->syconn = new SybaseConnection(new DSN('sybase://localhost:1999/'));
$this->myconn = new MySQLConnection(new DSN('mysql://localhost/'));
$this->pgconn = new PostgreSQLConnection(new DSN('pgsql://localhost/'));
$this->sqconn = new SqliteConnection(new DSN('sqlite://tmpdir/tmpdb'));
$this->peer = Job::getPeer();
}
示例3: setUp
/**
* Sets up a Database Object for the test
*
*/
public function setUp()
{
$this->conn[self::MYSQL] = new MySQLConnection(new DSN('mysql://localhost:3306/'));
$this->dialectClass[self::MYSQL] = 'rdbms.mysql.MysqlDialect';
$this->conn[self::SYBASE] = new SybaseConnection(new DSN('sybase://localhost:1999/'));
$this->dialectClass[self::SYBASE] = 'rdbms.sybase.SybaseDialect';
$this->peer = Job::getPeer();
}
示例4: genericFinderGetAll
public function genericFinderGetAll()
{
$this->getConnection()->setResultSet(new MockResultSet(array(0 => array('job_id' => 1, 'title' => $this->getName(), 'valid_from' => Date::now(), 'expire_at' => NULL), 1 => array('job_id' => 2, 'title' => $this->getName() . ' #2', 'valid_from' => Date::now(), 'expire_at' => NULL))));
$all = create(new GenericFinder(Job::getPeer()))->getAll(new Criteria());
$this->assertEquals(2, sizeof($all));
$this->assertClass($all[0], 'net.xp_framework.unittest.rdbms.dataset.Job');
$this->assertClass($all[1], 'net.xp_framework.unittest.rdbms.dataset.Job');
}
示例5: testJoinWithProjection
public function testJoinWithProjection()
{
$jp = new JoinProcessor(Job::getPeer());
$jp->setFetchModes(array('PersonJob->Department' => 'join'));
$jp->enterJoinContext();
$this->assertEquals('select PersonJob.job_id, PersonJob_Department.department_id from JOBS.job as start, JOBS.Person as PersonJob, JOBS.Department as PersonJob_Department where start.job_id *= PersonJob.job_id and PersonJob.department_id *= PersonJob_Department.department_id and 1 = 1', create(new Criteria())->setFetchmode(Fetchmode::join('PersonJob'))->setProjection(Projections::ProjectionList()->add(Job::column('PersonJob->job_id'))->add(Job::column('PersonJob->Department->department_id')))->getSelectQueryString($this->conn, $this->peer, $jp));
$jp->leaveJoinContext();
}
示例6: multipleJoinResultTest
public function multipleJoinResultTest()
{
$rs = new MockResultSet(array(array(JoinProcessor::FIRST . '_job_id' => '11', JoinProcessor::FIRST . '_title' => 'clean toilette', JoinProcessor::FIRST . '_valid_from' => new Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => '11', JoinProcessor::pathToKey(array('PersonJob')) . '_name' => 'Schultz', JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => '21', JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => '31'), array(JoinProcessor::FIRST . '_job_id' => '11', JoinProcessor::FIRST . '_title' => 'clean toilette', JoinProcessor::FIRST . '_valid_from' => new Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => '12', JoinProcessor::pathToKey(array('PersonJob')) . '_name' => 'Müller', JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => '11', JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => '31'), array(JoinProcessor::FIRST . '_job_id' => '12', JoinProcessor::FIRST . '_title' => 'second job', JoinProcessor::FIRST . '_valid_from' => new Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => '11', JoinProcessor::pathToKey(array('PersonJob')) . '_name' => 'Schultz', JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => '21', JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => '31'), array(JoinProcessor::FIRST . '_job_id' => '13', JoinProcessor::FIRST . '_title' => 'third job', JoinProcessor::FIRST . '_valid_from' => new Date(), JoinProcessor::FIRST . '_expire_at' => '', JoinProcessor::pathToKey(array('PersonJob')) . '_person_id' => NULL, JoinProcessor::pathToKey(array('PersonJob')) . '_name' => NULL, JoinProcessor::pathToKey(array('PersonJob')) . '_job_id' => NULL, JoinProcessor::pathToKey(array('PersonJob')) . '_department_id' => NULL)));
$jp = new JoinProcessor(Job::getPeer());
$jp->setFetchModes(array('PersonJob' => 'join'));
$ji = new JoinIterator($jp, $rs);
$this->assertTrue($ji->hasNext());
$this->assertClass($job = $ji->next(), 'net.xp_framework.unittest.rdbms.dataset.Job');
$this->assertArray($job->getPersonJobList());
$this->assertClass($pji = $job->getPersonJobIterator(), 'util.HashmapIterator');
$this->assertTrue($pji->hasNext());
$this->assertClass($pji->next(), 'net.xp_framework.unittest.rdbms.dataset.Person');
$this->assertTrue($pji->hasNext());
$this->assertClass($pji->next(), 'net.xp_framework.unittest.rdbms.dataset.Person');
$this->assertFalse($pji->hasNext());
$this->assertTrue($ji->hasNext());
$this->assertClass($job = $ji->next(), 'net.xp_framework.unittest.rdbms.dataset.Job');
$this->assertArray($job->getPersonJobList());
$this->assertClass($pji = $job->getPersonJobIterator(), 'util.HashmapIterator');
$this->assertTrue($pji->hasNext());
$this->assertClass($pji->next(), 'net.xp_framework.unittest.rdbms.dataset.Person');
$this->assertFalse($pji->hasNext());
$this->assertTrue($ji->hasNext());
$this->assertClass($job = $ji->next(), 'net.xp_framework.unittest.rdbms.dataset.Job');
$this->assertArray($job->getPersonJobList());
$this->assertClass($pji = $job->getPersonJobIterator(), 'util.HashmapIterator');
$this->assertFalse($pji->hasNext());
$this->assertFalse($ji->hasNext());
}
示例7: extractTest
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 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');
}
示例8: getPeer
/**
* Returns the Peer object for this finder
*
* @return rdbms.Peer
*/
public function getPeer()
{
return Job::getPeer();
}
示例9: setUp
/**
* Setup method
*
*/
public function setUp()
{
$this->conn = DriverManager::getConnection('mock://mock/JOBS?autoconnect=1');
$this->peer = Job::getPeer();
$this->peer->setConnection(DriverManager::getConnection('mock://mock/JOBS?autoconnect=1'));
}
示例10: ambiguous
public function ambiguous()
{
Job::getPeer()->getConnection()->setResultSet(new MockResultSet(array(array('job_id' => 1549, 'title' => 'Developer'), array('job_id' => 1549, 'title' => 'Doppelgänger'))));
$in = $this->newReader("job_id;title\n1549;10248")->withProcessors(array(new GetDataSet(create(new JobFinder())->method('byPrimary')), NULL));
$in->getHeaders();
try {
$in->read();
$this->fail('Lookup succeeded', NULL, 'lang.FormatException');
} catch (FormatException $expected) {
}
}
示例11: noSuchRoleTest
public function noSuchRoleTest()
{
$jp = new JoinProcessor(Job::getPeer());
$jp->setFetchModes(array('UnknowenRole' => 'join'));
}
示例12: testDoSelectMax
public function testDoSelectMax()
{
for ($i = 0; $i < 4; $i++) {
$this->setResults(new MockResultSet(array(0 => array('job_id' => 654, 'title' => 'Java Unit tester', 'valid_from' => Date::now(), 'expire_at' => NULL), 1 => array('job_id' => 655, 'title' => 'Java Unit tester 1', 'valid_from' => Date::now(), 'expire_at' => NULL), 2 => array('job_id' => 656, 'title' => 'Java Unit tester 2', 'valid_from' => Date::now(), 'expire_at' => NULL), 3 => array('job_id' => 657, 'title' => 'Java Unit tester 3', 'valid_from' => Date::now(), 'expire_at' => NULL))));
$this->assertEquals($i ? $i : 4, count(Job::getPeer()->doSelect(new Criteria(), $i)));
}
}