这是有问题的数据结构:
TYPO3\CMS\Extbase\Persistence\Generic\QueryResultprototypeobject (2 items)
0 => Plistvendor\Plistkey\Domain\Model\Partnerprototypepersistent entity (uid=16, pid=50)
1 => Plistvendor\Plistkey\Domain\Model\Partnerprototypepersistent entity (uid=17, pid=50)
name => 'Egal' (4 chars)
nachname => 'Nachname' (8 chars)
position => 'position2' (9 chars)
adresse => 'adresse 123 lorem ipsum' (24 chars)
land => 'Deutschland' (11 chars)
bild => TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity (uid=98, pid=50)
skype => 'skypename' (9 chars)
telefon => '90853490583094' (14 chars)
email => 'mail@email.de' (13 chars)
division => TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorageprototypeobject (1 items)
language => TYPO3\CMS\Extbase\Persistence\Generic\LazyObjectStorageprototypeobject (1 items)
000000004dac554500000000513665c6 => Plistvendor\Plistkey\Domain\Model\Languageprototypepersistent entity (uid=6, pid=50)
name => 'en' (2 chars)
uid => 6 (integer)
_localizedUid => 6 (integer)modified
_languageUid => 1 (integer)modified
_versionedUid => 6 (integer)modified
pid => 50 (integer)
uid => 17 (integer)
_localizedUid => 17 (integer)modified
_languageUid => -1 (integer)modified
_versionedUid => 17 (integer)modified
pid => 50 (integer)
现在我的问题是如何在Fluid或PHP中访问_languageUid
?
为了进一步参考,这里是我的控制器代码。我知道它非常糟糕,所以我愿意接受任何不会花费太多时间的建议。
public function listAction() {
$lang = $_GET['L'];
$partners = $this->partnerRepository->GetAll();
foreach ($partners as $key => $value) {
foreach ($value->getlanguage() as $key => $lval) {
echo $lval;
}
}
$this->view->assignMultiple(array('partners' => $partners));
}
在此控制器中,我可以回显$lval->getUid();
,它将返回语言Uid,但我需要访问_languageUid
/ sys_language_uid
。
答案 0 :(得分:2)
你需要一个公共的getter方法来获得这个属性,否则你就无法获得流量。以https://github.com/TYPO3-extensions/news/blob/master/Classes/Domain/Model/News.php#L1158-L1161
为例public function getSysLanguageUid()
{
return $this->_languageUid;
}
在PHP中,您可以使用方法_getProperty('_languageUid')