TYPO3 如何获取嵌套的私有成员
TYPO3 how to get nested private members
这里是有问题的数据结构:
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();
它会 return 语言 Uid 但是我需要访问 _languageUid
/sys_language_uid
.
这个属性需要一个publicgetter的方法,否则用fluid是搞不定的。以 https://github.com/TYPO3-extensions/news/blob/master/Classes/Domain/Model/News.php#L1158-L1161
为例
public function getSysLanguageUid()
{
return $this->_languageUid;
}
在PHP中,可以使用方法_getProperty('_languageUid')
这里是有问题的数据结构:
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();
它会 return 语言 Uid 但是我需要访问 _languageUid
/sys_language_uid
.
这个属性需要一个publicgetter的方法,否则用fluid是搞不定的。以 https://github.com/TYPO3-extensions/news/blob/master/Classes/Domain/Model/News.php#L1158-L1161
为例public function getSysLanguageUid()
{
return $this->_languageUid;
}
在PHP中,可以使用方法_getProperty('_languageUid')