[TYPO3-mvc] How to hide private domain class properties

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Tue Sep 20 13:29:19 CEST 2016


Hi Sebastian,

this call is part of the Extbase core code, not of my code... This is
why I want to prevent that Extbase calls getters of my private variables.

Regards,
Till

On 09/20/2016 09:43 AM, Sebastian Schreiber wrote:
> Hi Till,
> your error has nothing to do with MVC or any Framework.
> It is just how PHP works.
> Where and how do you call the call_user_func_array function?
>
> Show me the code and i tell you.
>
>
> Am 19.09.16 um 21:42 schrieb Frans Saris:
>> Hi Till,
>>
>> When do you get such errors? We use often properties that aren't exposed by
>> getter/setter and haven't run into such an issue. To be honest we normally
>> mark them as protected but don't think that matters.
>>
>> Groet Frans
>>
>> Op ma 19 sep. 2016 15:50 schreef <g4-lisz at tonarchiv.ch>:
>>
>>> He there,
>>>
>>> I already asked this question quite a while ago and never found a
>>> solution. Now I have this issue again and it would help me a lot to
>>> solve it:
>>>
>>> In some of my model classes I need helper arrays to cache some stuff.
>>> But I do not want them to be exposed to any MVC mechanism. I.e. I do not
>>> define any getters because there is nothing meaningful to get from
>>> outside of the class.
>>>
>>> But then I always get an error like:
>>>
>>> PHP Warning: call_user_func_array() expects parameter 1 to be a valid
>>> callback, class 'MyVend\Myext\Domain\Model\Betrieb' does not have a
>>> method 'get_hasXXX'.
>>>
>>> I tried with variable names staring with a underscore, declaring them as
>>> private... It does not help. The MVC "engine" always wants a getter for
>>> them.
>>>
>>> How can I hide variables in a model class? Is there maybe some
>>> annotation, like:
>>>
>>>   /*
>>>    * _doNotTouch  for internal use only
>>>    *
>>>    * @ignore
>>>    */
>>>   private $_doNotTouch = array();
>>>
>>>
>>> Of course I could write dummy getters for such variables. But it does
>>> not make much sense...
>>>
>>> Regards,
>>> Till
>>>
>>> _______________________________________________
>>> TYPO3-project-typo3v4mvc mailing list
>>> TYPO3-project-typo3v4mvc at lists.typo3.org
>>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc
>>>
>> _______________________________________________
>> TYPO3-project-typo3v4mvc mailing list
>> TYPO3-project-typo3v4mvc at lists.typo3.org
>> http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-project-typo3v4mvc




More information about the TYPO3-project-typo3v4mvc mailing list