[TYPO3-mvc] How to get images from ttcontent
Stefan Kruse
besucher80 at gmx.de
Thu Apr 10 17:22:45 CEST 2014
Hi Philip,
thats exact what i have done. My model looks like this:
/**
* @var
\TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model
\FileReference>
*/
protected $image;
/**
* __construct
* @return AbstractObject
*/
public function __construct() {
$this->images = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage
*/
public function getImage() {
/*if (!is_object($this->image)){
return null;
} elseif ($this->image instanceof
\TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy) {
$this->image->_loadRealInstance();
}*/
return $this->image;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage $image
* @return void
*/
public function setImage($image) {
$this->image = $image;
}
When I now fetch the tt_content objects and make a debug output the image
look like this:
image => TYPO3\CMS\Extbase\Persistence\ObjectStorageprototypeobject (3
items)
0000000060d98848000000005038e057 =>
TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity
(uid=1, pid=8)
fileRepository =>
TYPO3\CMS\Core\Resource\FileRepositorysingletonobject
objectType => 'TYPO3\CMS\Core\Resource\File' (28 chars)
table => 'sys_file' (8 chars)
indexerService => NULL
factory =>
TYPO3\CMS\Core\Resource\ResourceFactorysingletonobject
storageInstances => array(empty)
collectionInstances => array(empty)
fileInstances => array(empty)
fileReferenceInstances => array(empty)
signalSlotDispatcher =>
TYPO3\CMS\Extbase\SignalSlot\Dispatchersingletonobject
isInitialized => TRUE
objectManager =>
TYPO3\CMS\Extbase\Object\ObjectManagersingletonobjectfiltered
slots => array(empty)max depth
localDriverStorageCache => NULL
typeField => '' (0 chars)
type => '' (0 chars)
originalResource => NULL
uid => 1 (integer)
_localizedUid => 1 (integer)modified
_languageUid => 0 (integer)modified
pid => 8 (integer)
0000000060d988a0000000005038e057 =>
TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity
(uid=2, pid=8)
0000000060d988a5000000005038e057 =>
TYPO3\CMS\Extbase\Domain\Model\FileReferenceprototypepersistent entity
(uid=3, pid=8)
Everything is empty. I think this is not right. And what do you mean with
use the image viewhelper correctly?
Regards Stefan
More information about the TYPO3-project-typo3v4mvc
mailing list