1: <?php
2:
3: namespace PHPixie\Database\Conditions\Condition\Collection;
4:
5: class Placeholder extends \PHPixie\Database\Conditions\Condition\Implementation
6: implements \PHPixie\Database\Conditions\Condition\Collection
7: {
8: protected $container;
9: protected $allowEmpty;
10:
11: public function __construct($container, $allowEmpty = true)
12: {
13: $this->container = $container;
14: $this->allowEmpty = $allowEmpty;
15: }
16:
17: public function container()
18: {
19: return $this->container;
20: }
21:
22: public function conditions()
23: {
24: $conditions = $this->container->getConditions();
25:
26: if (empty($conditions))
27: if(!$this->allowEmpty)
28: throw new \PHPixie\Database\Exception\Builder("This placeholder cannot be empty");
29:
30: return $conditions;
31: }
32: }
33: