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

g4-lisz at tonarchiv.ch g4-lisz at tonarchiv.ch
Mon Sep 19 15:49:52 CEST 2016


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



More information about the TYPO3-project-typo3v4mvc mailing list