Пример #1
0
 protected function __construct(HermitContext $ctx, ReflectionClass $reflector, $target)
 {
     $this->context = $ctx;
     $this->target = $target;
     $this->annote = HermitAnnote::create($reflector);
     $this->commandFactory = new HermitSqlCommandFactory($ctx, $reflector);
 }
Пример #2
0
 public function match($matches)
 {
     if (count($matches) < 4) {
         throw new RuntimeException('sql comment was fail: ' . join(',', $matches));
     }
     list($all, $key, $name, $defaultValue) = $matches;
     if ($this->hasParameter($name)) {
         return $this->replace($key, $name, $defaultValue);
     }
     $annote = HermitAnnote::create($this->targetClass);
     $columns = $annote->getColumns();
     $columnsLower = array_map('strtolower', $columns);
     if (in_array(strtolower($name), $columnsLower)) {
         return $this->replace($key, $name, $defaultValue);
     }
     return $defaultValue;
 }
Пример #3
0
 public function __construct(HermitContext $ctx, ReflectionClass $reflector)
 {
     $this->context = $ctx;
     $this->annote = HermitAnnote::create($reflector);
     $this->reflector = $reflector;
 }