Example #1
0
      /*END*/
    ';
    public function getB(HogeDto $dto);
}
$pdo = new PDO('sqlite::memory:');
$pdo->exec('
create table A (
  hoge int,
  foo int
);
');
$pdo->exec('
create table B (
  hoge int,
  foo int
)
');
$refClass = new ReflectionClass('Hoge');
$refMethod_getA = $refClass->getMethod('getA');
$sqlCreatorA = new HermitStaticSqlCreator($refClass->getConstant('getA_SQL'));
$refMethod_getB = $refClass->getMethod('getB');
$sqlCreatorB = new HermitStaticSqlCreator($refClass->getConstant('getB_SQL'));
$builder = new HermitStatementBuilder($refMethod_getA, $sqlCreatorA);
$stmt = $builder->build($pdo);
$stmt->execute(array(200, 'abc'));
$builder = new HermitStatementBuilder($refMethod_getB, $sqlCreatorB);
$stmt = $builder->build($pdo);
$dto = new HogeDto();
$dto->hoge = 200;
$dto->foo = 'abc';
$stmt->execute(array($dto));
 private function createStatement($event = HermitEvent::UNKNOWN, array $parameters)
 {
     $pdo = $this->getConnection($event);
     $builder = new HermitStatementBuilder($this->context->getTargetClass(), $this->method, $this->sqlCreator);
     return $builder->build($pdo, $parameters);
 }
 public function __construct(ReflectionClass $targetClass, ReflectionMethod $method, HermitAnnote $annote, HermitSqlCreator $sqlCreator)
 {
     parent::__construct($targetClass, $method, $sqlCreator);
     $this->annote = $annote;
     $this->sqlCreator = $sqlCreator;
 }