Example #1
0
 /**
  * Return name in class or try to get from class name
  * @return string
  */
 public function getDbTableName()
 {
     // Name set in class
     if ($this->db_table) {
         return $this->db_table;
     }
     $db_table_from_class = mb_strtolower(Converter::from_camel_case(str_replace(['Entity', 'Repository'], '', Converter::classWithNamespaceToUnqualifiedShort($this)))) . 's';
     // Check DB in system tables
     $this->db_table = 'cms_' . $db_table_from_class;
     if (!SQL::tableExists($this->db_table)) {
         // Or in module tables
         $this->db_table = 'm_' . $db_table_from_class;
     }
     return $this->db_table;
 }