diff --git a/data-sources/datasource.union.php b/data-sources/datasource.union.php index bf75194..35a0b3d 100644 --- a/data-sources/datasource.union.php +++ b/data-sources/datasource.union.php @@ -240,7 +240,11 @@ public static function buildEditor(XMLElement $wrapper, array &$errors = array() $i = 0; foreach($datasources as $handle => $datasource) { $about = $datasource->about(); - $source = SectionManager::fetch($datasources[$handle]->getSource()); + $source = (new SectionManager) + ->select() + ->section($datasources[$handle]->getSource()) + ->execute() + ->next(); if(($source instanceof Section) === false) continue; @@ -278,7 +282,11 @@ public static function buildEditor(XMLElement $wrapper, array &$errors = array() if(!isset($datasources[$handle])) continue; $about = $datasources[$handle]->about(); - $source = SectionManager::fetch($datasources[$handle]->getSource()); + $source = (new SectionManager) + ->select() + ->section($datasources[$handle]->getSource()) + ->execute() + ->next(); if(($source instanceof Section) === false) continue; @@ -384,9 +392,11 @@ public function grab(array &$param_pool = null) { str_replace('-','_', $handle), $this->_env, true ); - $this->datasources[$handle]['section'] = SectionManager::fetch( - $this->datasources[$handle]['datasource']->getSource() - ); + $this->datasources[$handle]['section'] = (new SectionManager) + ->select() + ->section($this->datasources[$handle]['datasource']->getSource()) + ->execute() + ->next(); $result->appendChild( new XMLElement('section', General::sanitize($this->datasources[$handle]['section']->get('name')), array( @@ -506,7 +516,12 @@ public function grab_sql(Datasource $datasource) { include_once(TOOLKIT . '/class.entrymanager.php'); - if(!$section = SectionManager::fetch((int)$datasource->getSource())){ + if(!$section = (new SectionManager) + ->select() + ->section((int)$datasource->getSource()) + ->execute() + ->next() + ){ $about = $datasource->about(); trigger_error(__('The section associated with the data source %s could not be found.', array('' . $about['name'] . '')), E_USER_ERROR); } @@ -556,9 +571,11 @@ public function grab_sql(Datasource $datasource) { } // Handle real field instances else { - $field = FieldManager::fetch( - FieldManager::fetchFieldIDFromElementName($datasource->dsParamSORT, $datasource->getSource()) - ); + $field = (new FieldManager) + ->select() + ->field(FieldManager::fetchFieldIDFromElementName($datasource->dsParamSORT, $datasource->getSource())) + ->execute() + ->next(); $field->buildSortingSQL($joins, $where, $data['sort'], $datasource->dsParamORDER); @@ -841,7 +858,11 @@ public function output(XMLElement &$result, $entries, &$param_pool) { // Setup any datasources variables ONCE. if(!isset($ds['datasource']->_param_pool)) { $ds['datasource']->_param_pool = $param_pool; - $pool = FieldManager::fetch(array_keys($data)); + $pool = (new FieldManager) + ->select() + ->fields(array_keys($data)) + ->execute() + ->rows(); self::$field_pool += $pool; if (!isset($datasource->dsParamASSOCIATEDENTRYCOUNTS) || $datasource->dsParamASSOCIATEDENTRYCOUNTS == 'yes') { @@ -866,7 +887,11 @@ public function output(XMLElement &$result, $entries, &$param_pool) { foreach($data as $field_id => $values) { // Check to see if we have a Field object already, if not create one if(!isset(self::$field_pool[$field_id]) || !self::$field_pool[$field_id] instanceof Field) { - self::$field_pool[$field_id] = FieldManager::fetch($field_id); + self::$field_pool[$field_id] = (new FieldManager) + ->select() + ->field($field_id) + ->execute() + ->next(); } // Process output parameters @@ -913,7 +938,11 @@ public function output(XMLElement &$result, $entries, &$param_pool) { public function processDatasourceFilters(Datasource $datasource, &$where, &$joins, &$group) { if(!is_array($datasource->dsParamFILTERS) || empty($datasource->dsParamFILTERS)) return; - $pool = FieldManager::fetch(array_filter(array_keys($datasource->dsParamFILTERS), 'is_int')); + $pool = (new FieldManager) + ->select() + ->fields(array_filter(array_keys($datasource->dsParamFILTERS), 'is_int')) + ->execute() + ->rows(); self::$field_pool += $pool; foreach($datasource->dsParamFILTERS as $field_id => $filter){ diff --git a/extension.driver.php b/extension.driver.php index 4d4739e..7eeeed3 100644 --- a/extension.driver.php +++ b/extension.driver.php @@ -16,7 +16,7 @@ public static function registerProviders() { return true; } - public static function providerOf($type = null) { + public function providerOf($type = null) { self::registerProviders(); if(is_null($type)) return self::$provides; diff --git a/extension.meta.xml b/extension.meta.xml index 22dd341..5a53e3d 100644 --- a/extension.meta.xml +++ b/extension.meta.xml @@ -14,6 +14,11 @@ + + * Update for Symphony 4.x + * PHP7 Compatibility + * Replace deprecated method fetch() by select() + * [#43](https://github.com/brendo/uniondatasource/issues/43) Fix formatted textarea being escaped (thanks @Aonrud) * [#42](https://github.com/brendo/uniondatasource/issues/42) Prevent parameters from duplicating in the output (thanks @moretaste) diff --git a/templates/blueprints.datasource.tpl b/templates/blueprints.datasource.tpl index 5b84f69..395f73e 100644 --- a/templates/blueprints.datasource.tpl +++ b/templates/blueprints.datasource.tpl @@ -20,7 +20,7 @@ 'system:pagination' ); - public function __construct($env=NULL, $process_params=true){ + public function __construct($env = null, $process_params = true){ parent::__construct($env, $process_params); $this->_dependencies = array(); }