Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
16 / 16 |
CRAP | |
100.00% |
24 / 24 |
| StoredProcedure | |
100.00% |
1 / 1 |
|
100.00% |
16 / 16 |
16 | |
100.00% |
24 / 24 |
| __construct | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| newStoredProcedureParameter | |
100.00% |
1 / 1 |
1 | |
100.00% |
3 / 3 |
|||
| getName | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getDBName | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setName | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getModifies | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setModifies | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getResultType | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setResultType | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| getParameterList | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| getStatement | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| setStatement | |
100.00% |
1 / 1 |
1 | |
100.00% |
2 / 2 |
|||
| isEntityResult | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| isListResult | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| isResultSetResult | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| isResultTypeNone | |
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
|||
| <?php | |
| declare(strict_types = 1); | |
| namespace Siesta\Model; | |
| /** | |
| * @author Gregor Müller | |
| */ | |
| class StoredProcedure | |
| { | |
| const RESULT_LIST = "list"; | |
| const RESULT_ENITY = "entity"; | |
| const RESULT_RESULT_SET = "resultSet"; | |
| const RESULT_NONE = "none"; | |
| /** | |
| * @var Entity | |
| */ | |
| protected $entity; | |
| /** | |
| * @var string | |
| */ | |
| protected $name; | |
| /** | |
| * @var bool | |
| */ | |
| protected $modifies; | |
| /** | |
| * @var string | |
| */ | |
| protected $resultType; | |
| /** | |
| * @var $statement | |
| */ | |
| protected $statement; | |
| /** | |
| * @var StoredProcedureParameter[] | |
| */ | |
| protected $parameterList; | |
| /** | |
| * StoredProcedure constructor. | |
| * | |
| * @param Entity $entity | |
| */ | |
| public function __construct(Entity $entity) | |
| { | |
| $this->entity = $entity; | |
| $this->parameterList = []; | |
| } | |
| /** | |
| * @return StoredProcedureParameter | |
| */ | |
| public function newStoredProcedureParameter() : StoredProcedureParameter | |
| { | |
| $parameter = new StoredProcedureParameter(); | |
| $this->parameterList[] = $parameter; | |
| return $parameter; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getName() | |
| { | |
| return $this->name; | |
| } | |
| public function getDBName() | |
| { | |
| return $this->entity->getTableName() . "_" . $this->getName(); | |
| } | |
| /** | |
| * @param string $name | |
| */ | |
| public function setName($name) | |
| { | |
| $this->name = $name; | |
| } | |
| /** | |
| * @return boolean | |
| */ | |
| public function getModifies() | |
| { | |
| return $this->modifies; | |
| } | |
| /** | |
| * @param boolean $modifies | |
| */ | |
| public function setModifies($modifies) | |
| { | |
| $this->modifies = $modifies; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getResultType() | |
| { | |
| return $this->resultType; | |
| } | |
| /** | |
| * @param string $resultType | |
| */ | |
| public function setResultType($resultType) | |
| { | |
| $this->resultType = $resultType; | |
| } | |
| /** | |
| * @return StoredProcedureParameter[] | |
| */ | |
| public function getParameterList() | |
| { | |
| return $this->parameterList; | |
| } | |
| /** | |
| * @return string | |
| */ | |
| public function getStatement() | |
| { | |
| return $this->statement; | |
| } | |
| /** | |
| * @param string $statement | |
| */ | |
| public function setStatement($statement) | |
| { | |
| $this->statement = $statement; | |
| } | |
| /** | |
| * @return bool | |
| */ | |
| public function isEntityResult() : bool | |
| { | |
| return $this->resultType === self::RESULT_ENITY; | |
| } | |
| /** | |
| * @return bool | |
| */ | |
| public function isListResult() : bool | |
| { | |
| return $this->resultType === self::RESULT_LIST; | |
| } | |
| /** | |
| * @return bool | |
| */ | |
| public function isResultSetResult() : bool | |
| { | |
| return $this->resultType === self::RESULT_RESULT_SET; | |
| } | |
| /** | |
| * @return bool | |
| */ | |
| public function isResultTypeNone() : bool | |
| { | |
| return $this->resultType === self::RESULT_NONE; | |
| } | |
| } |