[TYPO3-english] extbase/fluid extension as PLUGIN_TYPE_CONTENT_ELEMENT

Muriel le Pair typo3 at strangefruit.nl
Tue Jun 25 09:50:48 CEST 2013


On 25-06-13 00:02, Andreas Kiessling wrote:
>> getRows() works fine. But how do you set or get for instance title
>> within rows[]?
>>
>> I try getTitle(), but this will produce a nasty fatal error:
>> Fatal error: Call to undefined method
>> SF\SfCodehighlighter\Domain\Model\Plugins\ItemRows::getTitle()
>>
>
> Where do you call getTitle()? You need to iterate over the rows to
> access the row records.

Hi,

I can output the values in a flexform, but I need to run them through a 
script before doing so.

The tt_content repository is injected in the main controller like this:

/**
* itemsRepository
*
* @var \SF\SfCodehighlighter\Domain\Repository\TtContentRepository
* @inject
*/
protected $itemsRepository;
	
/**
* inject the itemsRepository
*
* @param \SF\SfCodehighlighter\Domain\Repository\TtContentRepository 
$itemsRepository
* @return void
*/
public function 
injectItemsRepository(\SF\SfCodehighlighter\Domain\Repository\TtContentRepository 
$itemsRepository) {
      $this->itemsRepository = $itemsRepository;
}

De model ItemRows.php extends the tt_content model (what contains 
setRows() and getRows():
class ItemRows extends \SF\SfCodehighlighter\Domain\Model\TtContent {
So I guess that's why I can call setRows() without getting an error.

setRows() then includes the Items model:
/**
* Setter for Rows
*
* @param 
\TYPO3\CMS\Extbase\Persistence\ObjectStorage<SF\SfCodehighlighter\Domain\Model\Items> 
$rows
* @return void
*/
public function setRows($rows) {
     $this->rows = $rows;
}

And getRows() returns all fields from the Items model.
But when I try to call a function from the Items model PHP returns a
Fatal error: Call to undefined method 
SF\SfCodehighlighter\Domain\Model\Plugins\ItemRows::getTitle()

So how can I access (set and get) the values of the object that is 
created by rows?

--
kind regards,

Muriel le Pair









More information about the TYPO3-english mailing list