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

Frans Saris franssaris at gmail.com
Mon Sep 19 21:42:09 CEST 2016


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
>


More information about the TYPO3-project-typo3v4mvc mailing list