Zend framework2 ZFcuser通过内部联接获取信息

Zend framework2 ZFcuser通过内部联接获取信息,zend-framework2,zfcuser,Zend Framework2,Zfcuser,我有一个用户表,其中的store id列(store)与store表对应。 我正在使用自定义实体对象检索此存储id Application/Entity/User.php namespace Thuiswinkelen\Entity; class User extends \ZfcUser\Entity\User { /** * @var int */ protected $store; public function getStore() { return $this-&g

我有一个用户表,其中的store id列(store)与store表对应。 我正在使用自定义实体对象检索此存储id

Application/Entity/User.php

namespace Thuiswinkelen\Entity;

class User extends \ZfcUser\Entity\User
{

/**
 * @var int
 */
protected $store;


public function getStore()
{
    return $this->store;
}

/**
 * Set store.
 *
 * @param int $store
 * @return UserInterface
 */
public function setStore($store)
{
    $this->store = (int) $store;
    return $this;
}


}
我的问题是:如何在存储表中获取存储名称(使用内部联接?) 如果我可以使用以下内容,那就太好了:

<?php echo $this->zfcUserStoreId() ?> 
<?php echo $this->zfcUserStoreName() ?>

如果您希望映射实体关系;您将需要一个对象关系映射器(ORM),如条令来实现这一点

这将把您的外部标识符转换为对象,然后您可以在其中进行转换

$storeName = $user->getStore()->getName();
我猜您所建议的示例是由于已经存在的


但是,这是一种简化方法,有助于基于其他配置呈现用户名

你检查过条令中的一对多关系了吗?我已经设置了条令,它工作正常(非常有用!)。但我不知道如何使用getName();我想在布局中显示商店名称。你给我看的$user variabele和我有什么关系?