From: Andrey Kutejko Date: Sat, 27 Jul 2013 21:41:15 +0000 (+0300) Subject: remove unused code X-Git-Tag: 0.5~113 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=396bf7b2b142e4b8ea1b1779cb69e6327093085a;p=ipf.git remove unused code --- diff --git a/ipf/orm/record.php b/ipf/orm/record.php index 29b0e0d..1290ff6 100644 --- a/ipf/orm/record.php +++ b/ipf/orm/record.php @@ -460,19 +460,11 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab return $this->_values[$fieldName]; } - try { - if ( ! isset($this->_references[$fieldName]) && $load) { - $rel = $this->_table->getRelation($fieldName); - $this->_references[$fieldName] = $rel->fetchRelatedFor($this); - } - return $this->_references[$fieldName]; - } catch (IPF_ORM_Exception_Table $e) { - foreach ($this->_table->getFilters() as $filter) { - if (($value = $filter->filterGet($this, $fieldName, $value)) !== null) { - return $value; - } - } + if (!isset($this->_references[$fieldName]) && $load) { + $rel = $this->_table->getRelation($fieldName); + $this->_references[$fieldName] = $rel->fetchRelatedFor($this); } + return $this->_references[$fieldName]; } public function mapValue($name, $value) @@ -515,15 +507,7 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab } } } else { - try { - $this->coreSetRelated($fieldName, $value); - } catch (IPF_ORM_Exception_Table $e) { - foreach ($this->_table->getFilters() as $filter) { - if (($value = $filter->filterSet($this, $fieldName, $value)) !== null) { - break; - } - } - } + $this->coreSetRelated($fieldName, $value); } return $this; @@ -1036,11 +1020,6 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab return $this; } - public function unshiftFilter(IPF_ORM_Record_Filter $filter) - { - return $this->_table->unshiftFilter($filter); - } - public function unlink($alias, $ids = array()) { $ids = (array) $ids; diff --git a/ipf/orm/record/abstract.php b/ipf/orm/record/abstract.php index 6365187..cf46046 100644 --- a/ipf/orm/record/abstract.php +++ b/ipf/orm/record/abstract.php @@ -37,12 +37,6 @@ abstract class IPF_ORM_Record_Abstract extends IPF_ORM_Access } } - public function bindQueryParts(array $queryParts) - { - $this->_table->bindQueryParts($queryParts); - return $this; - } - public function loadGenerator(IPF_ORM_Record_Generator $generator) { $generator->initialize($this->_table); diff --git a/ipf/orm/record/filter.php b/ipf/orm/record/filter.php deleted file mode 100644 index ee65088..0000000 --- a/ipf/orm/record/filter.php +++ /dev/null @@ -1,19 +0,0 @@ -_table = $table; - } - - public function getTable() - { - return $this->_table; - } - - abstract public function filterSet(IPF_ORM_Record $record, $name, $value); - abstract public function filterGet(IPF_ORM_Record $record, $name); -} \ No newline at end of file diff --git a/ipf/orm/record/filter/compound.php b/ipf/orm/record/filter/compound.php deleted file mode 100644 index 289136d..0000000 --- a/ipf/orm/record/filter/compound.php +++ /dev/null @@ -1,58 +0,0 @@ -_aliases = $aliases; - } - public function init() - { - // check that all aliases exist - foreach ($this->_aliases as $alias) { - $this->_table->getRelation($alias); - } - } - - public function filterSet(IPF_ORM_Record $record, $name, $value) - { - foreach ($this->_aliases as $alias) { - if ( ! $record->exists()) { - if (isset($record[$alias][$name])) { - $record[$alias][$name] = $value; - - return $record; - } - } else { - // we do not want to execute N + 1 queries here, hence we cannot use get() - if (($ref = $record->reference($alias)) !== null) { - if (isset($ref[$name])) { - $ref[$name] = $value; - } - - return $record; - } - } - } - } - - public function filterGet(IPF_ORM_Record $record, $name) - { - foreach ($this->_aliases as $alias) { - if ( ! $record->exists()) { - if (isset($record[$alias][$name])) { - return $record[$alias][$name]; - } - } else { - // we do not want to execute N + 1 queries here, hence we cannot use get() - if (($ref = $record->reference($alias)) !== null) { - if (isset($ref[$name])) { - return $ref[$name]; - } - } - } - } - } -} \ No newline at end of file diff --git a/ipf/orm/record/filter/standard.php b/ipf/orm/record/filter/standard.php deleted file mode 100644 index d76c5c6..0000000 --- a/ipf/orm/record/filter/standard.php +++ /dev/null @@ -1,14 +0,0 @@ -_filters[] = new IPF_ORM_Record_Filter_Standard(); $this->_repository = new IPF_ORM_Table_Repository($this); } @@ -734,25 +732,6 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable return $record; } - final public function getProxy($id = null) - { - if ($id !== null) { - $identifierColumnNames = $this->getIdentifierColumnNames(); - $query = 'SELECT ' . implode(', ', (array) $identifierColumnNames) - . ' FROM ' . $this->getTableName() - . ' WHERE ' . implode(' = ? && ', (array) $identifierColumnNames) . ' = ?'; - $query = $this->applyInheritance($query); - - $params = array_merge(array($id), array_values($this->_options['inheritanceMap'])); - - $this->_data = $this->_conn->execute($query, $params)->fetch(PDO::FETCH_ASSOC); - - if ($this->_data === false) - return false; - } - return $this->getRecord(); - } - final public function applyInheritance($where) { if ( ! empty($this->_options['inheritanceMap'])) { @@ -1071,22 +1050,6 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable return $this->_options['queryParts'][$queryPart]; } - public function unshiftFilter(IPF_ORM_Record_Filter $filter) - { - $filter->setTable($this); - - $filter->init(); - - array_unshift($this->_filters, $filter); - - return $this; - } - - public function getFilters() - { - return $this->_filters; - } - public function __toString() { return IPF_ORM_Utils::getTableAsString($this);