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

Sebastian Schreiber me at schreibersebastian.de
Tue Sep 20 09:43:46 CEST 2016


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

-- 
Sebastian Schreiber
(Medieninformatiker B.Sc.)
(TYPO3 Certified Integrator)

Paul Nießen Straße 58
D-50969 Köln

T  0221 677 88 541
M  0176 431 05 790

Skype schreibersebastian.de

me at schreibersebastian.de
www.schreibersebastian.de

Steuernummer: 219 / 5302 / 3123



More information about the TYPO3-project-typo3v4mvc mailing list