[TYPO3-team-core-v5] Component Cache?

Malte Jansen mail at maltejansen.de
Thu Sep 25 23:02:05 CEST 2008


Ricardo Mieres schrieb:
> Ricardo Mieres escribió:
>> Hi!,
>>
>> I am having a litle problem with $this->componentFactory->getComponent 
>> it returns every time  the same reference to an object..
>>
>> example:
>> $nodeView = $this->componentFactory->getComponent('F3_CPanel_View_Node');
>> $nodeViewLeft = 
>> $this->componentFactory->getComponent('F3_CPanel_View_Node');
>>
>>
>> now I add some data to the indernal data array in $nodeView  and this 
>> data appear in $nodeViewLeft too.
>>
>>
>> it is needed a cache system by instancing of objects?
>>
>> Saludos.
>> Ricardo
>>
>>
>>
>>
> I am solve this problem using "clone".
Hi!

You have to set the scope of the F3_CPanel_View_Node to prototype.
Just add the "@scope prototype" to the class-comment, otherwise the 
component is implemented with singleton-pattern....

Cheers,

Malte


More information about the TYPO3-team-core-v5 mailing list