/**
  * @covers ::getRoot
  */
 public function testGetRoot()
 {
     $post = new ReflectionModel('Harp\\Harp\\Test\\TestModel\\Post');
     $this->assertEquals('Harp\\Harp\\Test\\TestModel\\Post', $post->getRoot()->getName());
     $blogPost = new ReflectionModel('Harp\\Harp\\Test\\TestModel\\BlogPost');
     $this->assertEquals('Harp\\Harp\\Test\\TestModel\\Post', $blogPost->getRoot()->getName());
 }
Exemple #2
0
 /**
  * Enables Repo "inheritance" allowing multiple repos to share one storage table
  * You will need to call setRootRepo on all the child repos.
  *
  * @param  boolean      $inherited
  * @return Config $this
  */
 public function setInherited($inherited)
 {
     $this->inherited = (bool) $inherited;
     if ($inherited) {
         if (!$this->reflectionModel->isRoot()) {
             $rootRepo = Container::get($this->reflectionModel->getRoot()->getName());
             $this->rootConfig = $rootRepo->getConfig();
         }
         $this->table = $this->rootConfig->getTable();
     }
     return $this;
 }