From 4af96141158fdcb0ecbef320af549fec6f8667f0 Mon Sep 17 00:00:00 2001 From: phpnut Date: Mon, 20 Feb 2006 08:45:44 +0000 Subject: [PATCH] Merging fixes and enhancements into trunk. Revision: [2068] Fixed typo in method names. Updated DboSource::conditions(). Added a delimiter --return that would be used in a complex condition string. NOTE: You limit your self to database specific code using this. Cake will not add the name() wrap around any of the Model.field. $this->Model->find('--return MY CUSTOM CONDITION STRING); Added ability to use a array key that will not have $this->value() called to wrap the $value. It is used like this (The word status will not have the value() called) Also note you can add Conditional selections used in the where clause: = Equal > Greater than < Less than >= Greater than or equal <= Less than or equal <> Not equal to LIKE can also use % with this $this->Model->find(array('Model.field' => '= value', 'Model.field' => '> value', 'Model.field' => '< value', 'Model.field' => '>= value', 'Model.field' => '<= value', 'Model.field' => '<> value', 'Model.field' => 'LIKE value', 'Model.field' => 'LIKE %value%', 'status', 'any key withou a => "value" wil not be wrapped')); git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2069 3807eeeb-6ff5-0310-8944-8be069107fe0 --- VERSION.txt | 2 +- cake/libs/model/datasources/dbo_source.php | 8 ++++++++ cake/libs/model/model_php4.php | 4 ++-- cake/libs/model/model_php5.php | 4 ++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index e05ea3b8e..d45934070 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -6,4 +6,4 @@ // +---------------------------------------------------------------------------------------------------+ // /////////////////////////////////////////////////////////////////////////////////////////////////////////// -0.10.8.2067 \ No newline at end of file +0.10.8.2069 \ No newline at end of file diff --git a/cake/libs/model/datasources/dbo_source.php b/cake/libs/model/datasources/dbo_source.php index eb474c95f..ec81ca3bf 100644 --- a/cake/libs/model/datasources/dbo_source.php +++ b/cake/libs/model/datasources/dbo_source.php @@ -1026,6 +1026,10 @@ class DboSource extends DataSource { $conditions = ' 1 = 1'; } + elseif (strpos($conditions, '--return') === 0) + { + $conditions = str_replace('--return', '', $conditions); + } else { preg_match_all('/([a-zA-Z0-9_]{1,})\\.([a-zA-Z0-9_]{1,})/', $conditions, $result, PREG_PATTERN_ORDER); @@ -1052,6 +1056,10 @@ class DboSource extends DataSource } $data[strlen($data)-2] = ')'; } + elseif (is_numeric($key)) + { + $data = ' '. $value; + } elseif (preg_match('/(?PLIKE\\x20|=\\x20|>\\x20|<\\x20|<=\\x20|>=\\x20|<>\\x20)(?P.*)/i', $value, $match)) { $data = $this->name($key) . ' '.$match['expression'].' '. $this->value($match['value']); diff --git a/cake/libs/model/model_php4.php b/cake/libs/model/model_php4.php index 12aad85df..90ed4857b 100644 --- a/cake/libs/model/model_php4.php +++ b/cake/libs/model/model_php4.php @@ -1157,7 +1157,7 @@ class Model extends Object if(isset($this->__backAssociation)) { - $this->__resetAssocitions(); + $this->__resetAssociations(); } return $return; } @@ -1171,7 +1171,7 @@ class Model extends Object * @return unknown * @access private */ - function __resetAssocitions() + function __resetAssociations() { foreach ($this->__associations as $type) { diff --git a/cake/libs/model/model_php5.php b/cake/libs/model/model_php5.php index bd109eab9..833460677 100644 --- a/cake/libs/model/model_php5.php +++ b/cake/libs/model/model_php5.php @@ -1152,7 +1152,7 @@ class Model extends Object if(isset($this->__backAssociation)) { - $this->__resetAssocitions(); + $this->__resetAssociations(); } return $return; } @@ -1166,7 +1166,7 @@ class Model extends Object * @return unknown * @access private */ - function __resetAssocitions() + function __resetAssociations() { foreach ($this->__associations as $type) {