Example #1
0
 function findEntityTable($obj, $default = null)
 {
     $table = $default;
     if (isset($obj->_type)) {
         $table = $obj->_type;
     } else {
         $c = get_class($obj);
         if ($c != $this->entityClassDefault) {
             $c = CaseConvert::lcw($c);
             foreach ($this->entityClassPrefix as $prefix) {
                 if ($prefix && strpos($c, $prefix) === 0) {
                     $c = substr($c, strlen($prefix));
                     if (substr($c, 0, 1) === '_' && in_array(strtolower(substr($c, 1)), self::$phpReservedKeywords)) {
                         $c = substr($c, 1);
                     }
                     $table = $c;
                     break;
                 }
             }
         }
     }
     return $table;
 }
Example #2
0
 function findEntityTable($obj, $default = null)
 {
     $table = $default;
     if (isset($obj->_type)) {
         $table = $obj->_type;
     } else {
         $c = get_class($obj);
         if ($c != $this->entityClassDefault) {
             if ($this->modelClassSuffix == '' || substr($c, -1 * strlen($this->modelClassSuffix)) == $this->modelClassSuffix) {
                 foreach ($this->modelClassPrefix as $prefix) {
                     if ($prefix === false) {
                         continue;
                     }
                     if ($prefix == '' || substr($c, 0, strlen($prefix)) === $prefix) {
                         $table = substr($c, strlen($prefix), -4);
                         break;
                     }
                 }
             }
             $table = CaseConvert::lcw($table);
         }
     }
     return $table;
 }