[TYPO3-german] Mehrere Bilder in Show-Action ausgeben
carsten falkenberg
codefresser at gmail.com
Fri Feb 6 20:47:08 CET 2015
Und im Fluid siehts zusammengefasst so aus:
<f:for each="{images}" as="image">
<f:image src="{image.uid}" treatIdAsReference="1"
/>
</f:for>
2015-02-06 20:43 GMT+01:00 carsten falkenberg <codefresser at gmail.com>:
> Hallo Gunnar,
>
> in meinem Model sieht das etwas anders aus. Vielleicht hilft das schon
> weiter.
>
> Gruß
> Carsten
>
> /**
> * images
> *
> * @var
>
> \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
> * @lazy
> * @cascade remove
> */
> protected $images = NULL;
>
>
>
> /**
> * Initializes all ObjectStorage properties
> * Do not modify this method!
> * It will be rewritten on each save in the extension builder
> * You may modify the constructor of this class instead
> *
> * @return void
> */
> protected function initStorageObjects() {
> $this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
> }
>
> /**
> * Adds a FileReference
> *
> * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
> * @return void
> */
> public function addImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference
> $image) {
> $this->images->attach($image);
> }
>
> /**
> * Removes a FileReference
> *
> * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove
> The FileReference to be removed
> * @return void
> */
> public function
> removeImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $imageToRemove) {
> $this->images->detach($imageToRemove);
> }
>
> /**
> * Returns the images
> *
> * @return
>
> \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
> $images
> */
> public function getImages() {
> return $this->images;
> }
>
> /**
> * Sets the images
> *
> * @param
>
> \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
> $images
> * @return void
> */
> public function setImages(\TYPO3\CMS\Extbase\Persistence\ObjectStorage
> $images) {
> $this->images = $images;
> }
>
> 2015-02-06 20:15 GMT+01:00 Gunnar Vaupunkt <hallo at gunnarvogelsang.de>:
>
> > Hmm, also entweder ist mein Problem so komplex, dass niemand ne Idee hat,
> > oder ich hab zu wenig Infos eingestellt. Also anbei nochmal der aktuelle
> > Stand der Dinge!
> >
> > Also so sieht das ganze bei mir momentan aus:
> > SQL
> >
> >
> > image int(11) unsigned NOT NULL default '0',
> >
> >
> > TCA
> >
> >
> > 'image' => array(
> > 'exclude' => 1,
> > 'label' => 'LLL:EXT:gv_test/Resources/Private/Language/locallang_db.
> > xlf:tx_gvtest_domain_model_test.image',
> > 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::
> > getFileFieldTCAConfig(
> > 'image',
> > array('maxitems' => 10),
> > $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']
> > ),
> > ),
> >
> >
> > Model
> >
> >
> > class Test extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
> >
> > /**
> > * image
> > *
> > * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\
> > TYPO3\CMS\Extbase\Domain\Model\FileReference>
> > */
> > protected $image;
> >
> > /**
> > * __construct
> > *
> > * @return AbstractObject
> > */
> > public function __construct() {
> > $this->image = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
> > }
> >
> > /**
> > * get the Image
> > *
> > * @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
> > */
> > public function getImages() {
> > return $this->image;
> > }
> >
> > /**
> > * sets the Image
> > *
> > * @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $image
> > *
> > * @return void
> > */
> > public function setImages($image) {
> > $this->image = $image;
> > }
> > }
> >
> >
> > Fluid
> >
> >
> > <table class="tx-gv-test" >
> > <tr>
> > <td>
> > <f:translate key="tx_gvtest_domain_model_test.image" />
> > </td>
> > <td>
> > <f:debug>{test}</f:debug>
> > <f:for each="{test.image}" as="thisimage">
> > <f:debug>{thisimage.originalResource}</f:debug>
> > </f:for>
> > </td>
> > </tr>
> > </table>
> >
> >
> > Debug Ausgabe
> >
> >
> > Extbase Variable Dump
> >
> > GunVog\GvTest\Domain\Model\Testprototypepersistent entity (uid=1,
> > pid=59)
> > image => TYPO3\CMS\Extbase\Persistence\ObjectStorageprototypeobject (2
> > items)
> > 000000006df6792d000000007757f5cc => TYPO3\CMS\Extbase\Domain\Model\
> > FileReferenceprototypepersistent entity (uid=120, pid=59)
> > originalResource => NULL
> > uid => 120 (integer)
> > _localizedUid => 120 (integer)modified
> > _languageUid => 0 (integer)modified
> > _versionedUid => 120 (integer)modified
> > pid => 59 (integer)
> > 000000006df6792a000000007757f5cc => TYPO3\CMS\Extbase\Domain\Model\
> > FileReferenceprototypepersistent entity (uid=121, pid=59)
> > originalResource => NULL
> > uid => 121 (integer)
> > _localizedUid => 121 (integer)modified
> > _languageUid => 0 (integer)modified
> > _versionedUid => 121 (integer)modified
> > pid => 59 (integer)
> > uid => 1 (integer)
> > _localizedUid => 1 (integer)modified
> > _languageUid => 0 (integer)modified
> > _versionedUid => 1 (integer)modified
> > pid => 59 (integer)
> >
> >
> > Die foreach Schleife wird überhaupt nicht durchlaufen und
> originalResource
> > ist NULL. Hmmm :(
> >
> > _______________________________________________
> > TYPO3-german mailing list
> > TYPO3-german at lists.typo3.org
> > http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
> >
> _______________________________________________
> TYPO3-german mailing list
> TYPO3-german at lists.typo3.org
> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-german
>
More information about the TYPO3-german
mailing list