getTableByRepositoryClass() public method

Gets table name from repository class name
public getTableByRepositoryClass ( string $repositoryClass ) : string
$repositoryClass string
return string
Example #1
0
 public function addRepository(\Joseki\LeanMapper\Repository $repository)
 {
     $class = get_class($repository);
     $table = $this->mapper->getTableByRepositoryClass($class);
     $entity = $this->mapper->getEntityClass($table);
     $this->entities[] = new $entity();
 }
Example #2
0
 /**
  * Gets name of (main) database table related to entity that repository can handle
  *
  * @return string
  * @throws InvalidStateException
  */
 protected function getTable()
 {
     if ($this->table === null) {
         if (!$this->tableAnnotationChecked) {
             $this->tableAnnotationChecked = true;
             $table = AnnotationsParser::parseSimpleAnnotationValue('table', $this->getDocComment());
             if ($table !== null) {
                 return $this->table = $table;
             }
         }
         $this->table = $this->mapper->getTableByRepositoryClass(get_called_class());
     }
     return $this->table;
 }