Пример #1
0
 /**
  * @param $name
  * @return mixed
  * @throws \OutOfBoundsException
  */
 public function __get($name)
 {
     $fn = 'get' . Inflector::classify($name);
     if (method_exists($this, $fn)) {
         return $this->{$fn}();
     } else {
         throw new \OutOfBoundsException("getter '{$fn}' does not exist");
     }
 }
Пример #2
0
 /**
  * @param $op
  * @return string
  */
 public function getLookUpMethod($op)
 {
     return Inflector::camelize('lookup_' . $op);
 }
Пример #3
0
 /**
  * @param $tname
  * @return string
  */
 protected function table2model($tname)
 {
     return $this->prefix . Inflector::classify($tname);
 }
Пример #4
0
 public function testCamelize()
 {
     $this->assertEquals('myTableName', \Dja\Util\Inflector::camelize('my_table_name'));
 }
Пример #5
0
 /**
  * return manual setted or generate table name
  * User -> users, UserRole -> user_roles
  * @return null|string
  */
 public function getDbTableName()
 {
     if ($this->dbTableName === null) {
         $this->dbTableName = Inflector::namespacedTableize($this->modelClassName);
     }
     return $this->dbTableName;
 }