title: PHP Factory Class Inheritance Issue
body: <p>I have worked on my own factory class that instantiates dependencies and passes through constructs when a dependency is set/requested. If the dependency is cached ( Has already been instantiated by another class ) i pass that class instance instead of instantiating all over again ( mainly used for db connection ). The issue i am having at the moment is as follows.</p>
  
  <p>** To avoid a large question &amp; save reading time i am attempting to illustrate the issue as simply as possible, if the actual code is needed i can paste in.</p>
  
  <pre><code>Class View {
      // Construct Requests User Model
  }
  
  Class Controller {
      // Construct Requests User Model &amp; Class View
      $this-&gt;user-&gt;set($newuserid);
      $this-&gt;view-&gt;display('file');
  }
  </code></pre>
  
  <p>So <code>Controller</code> is instantiated, since <code>View</code> is set as a dependencies it is instantiated and passed to <code>Controller</code> via <code>__construct</code>. Everything is fine, but for things like a profile page. Where i set a new user ( illustrated above ) setting the new userid also alters the userid that is contained within the <code>View</code> User Model. I am not using static vars so i am confused as to why changed made in <code>controller</code> affect the <code>view</code> user model. This causes an issue for me because the logged in User's ID is set via entry point of site ( bootstrap ) &amp; errors are caused when the profile page overwrites the logged in users id. I have added a <code>newInstance</code> option within my factory, to instead instantiate a new user model for the user profile. Things work fine, but i am still curious as to why i had/have this issue.</p>