public function createProxy(HermitContext $ctx, HermitProxy $proxy)
 {
     $instance = self::getInstance();
     $targetClass = $ctx->getName();
     $proxyClass = $instance->transactionProxy[$targetClass];
     return new $proxyClass($ctx, $proxy, $instance, 'proceed');
 }
Example #2
0
 protected static function wrap(HermitContext $ctx, HermitProxy $proxy)
 {
     if (0 < count(self::$behaviors)) {
         $targetClass = $ctx->getName();
         foreach (self::$behaviors as $behavior) {
             if ($behavior->has($targetClass)) {
                 return $behavior->createProxy($ctx, $proxy);
             }
         }
     }
     return $proxy;
 }
 public function create(PDO $pdo, HermitContext $context)
 {
     $creator = $this->createProcedureSqlCreator($pdo);
     $creator->initialize($pdo, $this->method, $this->annote);
     $valueType = HermitValueTypeFactory::create($this->annote, $this->method);
     $batchMode = $this->annote->getBatchMode($this->method);
     $context->setBatchMode($batchMode);
     $command = new HermitProcedureCommand();
     $command->setContext($context);
     $command->setMethod($this->method);
     $command->setSqlCreator($creator);
     $command->setValueType($valueType);
     $command->setAnnote($this->annote);
     return $command;
 }
 public function create(PDO $pdo, HermitContext $context)
 {
     $sqlCreator = $this->getStaticSqlCreator($pdo);
     if (null === $sqlCreator) {
         $sqlCreator = new HermitAutoInsertSqlCreator();
     }
     $sqlCreator->initialize($pdo, $this->method, $this->annote);
     $valueType = HermitValueTypeFactory::create($this->annote, $this->method);
     $batchMode = $this->annote->getBatchMode($this->method);
     $context->setBatchMode($batchMode);
     $command = new HermitInsertCommand();
     $command->setContext($context);
     $command->setMethod($this->method);
     $command->setSqlCreator($sqlCreator);
     $command->setValueType($valueType);
     return $command;
 }
 public function create(PDO $pdo, HermitContext $context)
 {
     $creator = $this->createSelectSqlCreator($pdo);
     $creator->initialize($pdo, $this->method, $this->annote);
     if ($creator instanceof HermitAppendableSqlCreator) {
         $this->appendSql($creator);
     }
     $valueType = HermitValueTypeFactory::create($this->annote, $this->method);
     $batchMode = $this->annote->getBatchMode($this->method);
     $context->setBatchMode($batchMode);
     $command = new HermitSelectCommand();
     $command->setContext($context);
     $command->setMethod($this->method);
     $command->setSqlCreator($creator);
     $command->setValueType($valueType);
     return $command;
 }