本文整理汇总了PHP中Doctrine\ORM\Query\ResultSetMapping::getFieldName方法的典型用法代码示例。如果您正苦于以下问题:PHP ResultSetMapping::getFieldName方法的具体用法?PHP ResultSetMapping::getFieldName怎么用?PHP ResultSetMapping::getFieldName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\ORM\Query\ResultSetMapping
的用法示例。
在下文中一共展示了ResultSetMapping::getFieldName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testBasicResultSetMapping
/**
* For SQL: SELECT id, status, username, name FROM cms_users
*/
public function testBasicResultSetMapping()
{
$this->_rsm->addEntityResult('Doctrine\\Tests\\Models\\CMS\\CmsUser', 'u');
$this->_rsm->addFieldResult('u', 'id', 'id');
$this->_rsm->addFieldResult('u', 'status', 'status');
$this->_rsm->addFieldResult('u', 'username', 'username');
$this->_rsm->addFieldResult('u', 'name', 'name');
$this->assertFalse($this->_rsm->isScalarResult('id'));
$this->assertFalse($this->_rsm->isScalarResult('status'));
$this->assertFalse($this->_rsm->isScalarResult('username'));
$this->assertFalse($this->_rsm->isScalarResult('name'));
$this->assertTrue($this->_rsm->getClassName('u') == 'Doctrine\\Tests\\Models\\CMS\\CmsUser');
$class = $this->_rsm->getDeclaringClass('id');
$this->assertTrue($class == 'Doctrine\\Tests\\Models\\CMS\\CmsUser');
$this->assertEquals('u', $this->_rsm->getEntityAlias('id'));
$this->assertEquals('u', $this->_rsm->getEntityAlias('status'));
$this->assertEquals('u', $this->_rsm->getEntityAlias('username'));
$this->assertEquals('u', $this->_rsm->getEntityAlias('name'));
$this->assertEquals('id', $this->_rsm->getFieldName('id'));
$this->assertEquals('status', $this->_rsm->getFieldName('status'));
$this->assertEquals('username', $this->_rsm->getFieldName('username'));
$this->assertEquals('name', $this->_rsm->getFieldName('name'));
}