AclQueryItems.php 722 B

1234567891011121314151617181920212223
  1. <?php
  2. class AclQueryItems {
  3. public function __construct($acl) {
  4. $this->_acl = $acl;
  5. $this->_params = [];
  6. $this->_source = 'default_db';
  7. }
  8. public function setParams($params) { $this->_params = $params; }
  9. public function setSource($sourceName) { $this->_source = $sourceName; }
  10. public function setRawSql($sql) { $this->_sql = $sql; }
  11. public function fetchAll() {
  12. return array_map(array($this, 'buildFeatureFromSqlRow'), DB::getPDO($this->_source)->fetchAll($this->_sql));
  13. }
  14. public function buildFeatureFromSqlRow($item) {
  15. if (method_exists($this->_acl, 'buildFeatureFromSqlRow')) {
  16. return $this->_acl->buildFeatureFromSqlRow($item, $this->_params);
  17. }
  18. return $item;
  19. }
  20. }