2009-01-20 20:07:07 +03:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* To change this template, choose Tools | Templates
|
|
|
|
* and open the template in the editor.
|
|
|
|
*/
|
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
namespace Doctrine\ORM\Query\AST;
|
|
|
|
|
2009-01-20 20:07:07 +03:00
|
|
|
/**
|
|
|
|
* Description of InputParameter
|
|
|
|
*
|
|
|
|
* @author robo
|
|
|
|
*/
|
2009-01-22 22:38:10 +03:00
|
|
|
class InputParameter extends Node
|
2009-01-20 20:07:07 +03:00
|
|
|
{
|
|
|
|
private $_isNamed;
|
|
|
|
private $_position;
|
|
|
|
private $_name;
|
|
|
|
|
|
|
|
public function __construct($value)
|
|
|
|
{
|
2009-03-21 22:58:52 +03:00
|
|
|
if (strlen($value) == 1) {
|
|
|
|
throw new \InvalidArgumentException("Invalid parameter format.");
|
|
|
|
}
|
|
|
|
|
2009-01-20 20:07:07 +03:00
|
|
|
$param = substr($value, 1);
|
|
|
|
$this->_isNamed = ! is_numeric($param);
|
|
|
|
if ($this->_isNamed) {
|
|
|
|
$this->_name = $param;
|
|
|
|
} else {
|
|
|
|
$this->_position = $param;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isNamed()
|
|
|
|
{
|
|
|
|
return $this->_isNamed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function isPositional()
|
|
|
|
{
|
|
|
|
return ! $this->_isNamed;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getName()
|
|
|
|
{
|
|
|
|
return $this->_name;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getPosition()
|
|
|
|
{
|
|
|
|
return $this->_position;
|
|
|
|
}
|
2009-03-23 20:39:33 +03:00
|
|
|
|
|
|
|
public function dispatch($sqlWalker)
|
|
|
|
{
|
|
|
|
return $sqlWalker->walkInputParameter($this);
|
|
|
|
}
|
2009-02-20 08:46:20 +03:00
|
|
|
}
|