title: Call object that another object is contained in
body: <p>So I'd like to be able to call a method of an object from a created object as deep as I'd like.</p>
  
  <p>For example </p>
  
  <pre><code>$test = new sampleObject;
  $test2 = $test-&gt;createChild();
  $test3 = $test2-&gt;createChild();
  ...
  </code></pre>
  
  <p>catch is, I need to be able to refer to a method from the topmost creator class.</p>
  
  <p>so I have my main class</p>
  
  <pre><code>class sampleObject
  {
      public $tons, $of, $properties;
  
      public function createChild()
      {
          $someVar = new childObject();
          $this-&gt;otherMethod();
          return $someVar();
      }
  
      public function otherMethod()
      {
          //Do some stuff
      }
  }
  
  class childObject
  {
      public $child, $properties;
  
      function createChild()
      {
          $someVar = new childObject();
          //here is my issue
          //I need to call a otherMethod from the creating class here but not static .
          return $someVar;
      }
  }
  </code></pre>
  
  <p>Is this the wrong approach or is there a way to reference that creating class object.
  I'd like to keep the created object's properties secluded from the creator class. </p>
  
  <p>I thought about just passing the object, but I'd like to keep the same structure if possible as the creator class. </p>