title: How to pass always used properties from controller to other classes in MVC?
body: <p>I'm currently improving my own MVC and I can't find a nice solution for the following scenario:
  In most of my models I'm working with a few (already validated by another model) user-based inputs and need to pass them from the controller (where I basically tell the models what to do with the input) to the various models of course. At the moment I'm putting every single user input into a property:</p>
  
  <pre><code>    foreach($this-&gt;properties as $property =&gt; $empty)
      {
          if(isset($_POST[$property]))
          {
              $this-&gt;properties[$property] = htmlspecialchars(trim($_POST[$property]));
          }
      }
  </code></pre>
  
  <p>Eventually when I need a new model to do something, I call it like this:</p>
  
  <pre><code>    new view('calendar',$data,$this-&gt;properties);
  </code></pre>
  
  <p>And finally in the model I receive the input / variables by putting them in the models properties…</p>
  
  <pre><code>class validation
  {   
  
      public function __construct($values)
      {
          foreach($values as $property =&gt; $value)
          {
              $this-&gt;{$property} = $value;
          }
      }
  }
  </code></pre>
  
  <p>That way I never have to think about where a variable comes from (after the user input has been validated, I don't really care anymore) and can always write a for me clean to read version of <code>$this-&gt;user_input</code></p>
  
  <p>But I somehow have the feeling that this is not the easiest way and propably not a good one either. What bothers me the most is that when writing a new class/model, I always have to tell the model to take the input into their own property and I always have to pass parameters when calling a new class.</p>
  
  <p>Is there some way where I can just inherit these variables from the user when a new class is getting called without having the controller to be a parent class - or would this actually make sense to make the controller a parent? I think it would be confusing when another controller uses the model.</p>