Пример #1
0
 /**
  * @param $string
  * @return string
  */
 public function valueMapping($string)
 {
     $matches = [];
     if (preg_match('/@([a-zA-Z\\d_\\-]+).@([a-zA-Z\\d_\\-]+)/', $string, $matches)) {
         $table = '';
         $column = '';
         if ($matches[1] == 'this') {
             $table = $this->classMapping['Table']->name;
             $column = $this->propertiesMapping[$matches[2]];
         } else {
             $nameSpace = $this->reflectionClass->getNamespaceName();
             $mapping = Mapping::getReader($nameSpace . '\\' . ucfirst($matches[1]));
             $table = $mapping->getClassMapping('Table')->name;
             $properties = $mapping->getPropertiesMapping();
             $column = $properties[$matches[2]];
         }
         return '`' . $table . '`' . '.' . '`' . $column . '`';
     } else {
         return $string;
     }
 }