mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
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
This commit is contained in:
parent
35997a1e84
commit
4af9614115
4 changed files with 13 additions and 5 deletions
|
@ -6,4 +6,4 @@
|
|||
// +---------------------------------------------------------------------------------------------------+ //
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
0.10.8.2067
|
||||
0.10.8.2069
|
|
@ -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('/(?P<expression>LIKE\\x20|=\\x20|>\\x20|<\\x20|<=\\x20|>=\\x20|<>\\x20)(?P<value>.*)/i', $value, $match))
|
||||
{
|
||||
$data = $this->name($key) . ' '.$match['expression'].' '. $this->value($match['value']);
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue