[TYPO3-mvc] How to use FAL?
bernd wilke
t3ng at bernd-wilke.net
Mon Jul 15 12:25:57 CEST 2013
Am 15.07.13 11:10, schrieb bernd wilke:
> Am 15.07.13 10:25, schrieb Tobias Liegl:
>> Hi Bernd,
>>
>> maybe this article (and the link to the gist) helps you:
>> http://buzz.typo3.org/teams/extbase/article/fal-and-extbase-the-easy-part/
>>
>> https://gist.github.com/maddy2101/5668835
>>
>
> it should help.
>
> first debug seems ok:
> :
> addImgs =>
> TYPO3\CMS\Extbase\Persistence\ObjectStorageprototypeobject (2 items)
> 000000003baf4acb00000000e2938a8a =>
> TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity
> (uid=35, pid=781)
> 000000003baf4ac400000000e2938a8a =>
> TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity
> (uid=34, pid=781)
> :
>
> but then I call a partial:
> <f:render partial="Detail/MediaContainer2" arguments="{media:
> newsItem.addImgs, settings:settings}" />
>
> and in the partial 'media' is NULL.
> where got the filereferences lost?
>
got it working, but is it correct???
instead of the simple getter
/**
* Returns the addImgs
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*
*/
public function getAddImgs() {
return $this->AddImgs;
}
I use this:
/**
* _addImgs
*
* @var \array
*/
protected $_addImg;
/**
* Returns the addImgs
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference
*
*/
public function getAddImgs() {
if (count($this->_addImgs)) {
return $this->_addImgs;
}
if ($this->addImgs) {
foreach ($this->addImgs as $imageObject) {
try {
$this->_addImgs[] = $imageObject;
} catch (Exception $e) {
// it is possible the url is moved or removed
}
}
}
return $this->_addImgs;
}
--
http://www.pi-phi.de/cheatsheet.html
More information about the TYPO3-project-typo3v4mvc
mailing list