Commit graph

321 commits

Author SHA1 Message Date
mark_story
01be15d654 Don't always wipe a Model's _schema property when calling setSource()
Only wipe the internal schema cache if listSources() returned a useful
list of sources. Otherwise retain the old schema. This lets datasources
that don't implement listSources to be combined with models that define
static schema properties.

Fixes #2467
2013-12-16 14:42:21 -05:00
Rachman Chavik
2d5a153c0d Set 'order' to false to prevent issues with postgres
See: https://github.com/cakephp/cakephp/pull/2421#issuecomment-30074971
2013-12-08 16:40:22 +07:00
ADmad
f3900e89fd Fixed bug where deleteAll tried to delete same id multiple times.
Ensure find done in deleteAll only returns distinct ids. A wacky
combination of association and conditions can sometimes generate
multiple rows per id.
2013-12-03 22:18:17 +05:30
mark_story
1be40d5d64 Fix coding standards error.
Refs #2364
2013-11-19 18:36:52 -05:00
mark_story
ec38ee1c48 Only enable cacheSources if both the datasource + model agree on it.
This prevents models from flipping cacheSources on when the datasource
has it disabled already.

Refs #2364
2013-11-19 17:36:20 -05:00
mark_story
99fd6e40fe Leave db->cacheSources unaltered.
When a model uses cacheSources = false, it should not have side effects
on the datasource.

Fixes #2364
2013-11-19 15:06:55 -05:00
Marc Würth
7cfa0116f4 Removed "PHP 5" from file header DocBlocks
This statement does not serve a purpose anymore.
In a long forgotten world it indicated the main version number of PHP which the code in the file was compatible to.
http://pear.php.net/manual/en/standards.sample.php
But since PHP 5.1 and later this is only marginally true.
Thus I propose to remove it from CakePHP.
2013-11-13 22:58:39 +01:00
José Moreira
b1e366c500 Model.php PHPDoc Description: Chang afterFilter with afterFind 2013-11-10 16:59:28 +00:00
Mark Story
ea0c66e713 Merge pull request #2187 from bar/model-optimizations
Optimize conditionals and reduce lookups.
2013-10-24 14:09:47 -07:00
Ber Clausen
1fbe9c0021 Optimize conditionals and reduce lookups.
Also, make the code easier to read removing unneded indentations.
2013-10-24 10:16:55 -03:00
Marc Würth
7c07d37fb3 Some DocBlock improvements for Model.php 2013-10-24 13:05:32 +02:00
Ber Clausen
6dcfd28600 Optimize _clearCache().
It is cheaper to make an assignment or call strtolower() than to pluralize.
2013-10-23 22:29:42 -03:00
Bryan Crowe
a943ea5c34 Add space between classname(s) 2013-10-22 22:59:50 -04:00
José Lorenzo Rodríguez
99620ab58e Merge pull request #1593 from kimegede/more-readable-code
More readable code
2013-10-11 15:51:28 -07:00
Bryan Crowe
4242bd4f3d Additional Cake references to CakePHP and docblock typo 2013-10-09 19:38:16 -04:00
Schlaefer
be61a5023f Refactors Model::_clearCache
- don't use mixed keys in $assoc array
- removes unnecessary strtolower on Inflector::underscore result
- return early
2013-09-28 10:16:23 +02:00
Schlaefer
99ec97bd19 performance improvements in Model::_clearCache
- don't empty cache twice if pluralized name is identical to underscored
- refactors for fewer function calls
2013-09-27 16:39:23 +02:00
mark_story
4ea6c158d1 Fix wording and remove trailing spaces. 2013-09-16 12:04:29 -04:00
Jerome Roethlisberger
3a4a0e54eb Improved wording of Model::invalidFields()
Inspired by
http://book.cakephp.org/2.0/en/models/data-validation/validating-data-from-the-controller.html#validating-data-from-the-controller
2013-09-16 16:13:58 +02:00
Ber Clausen
0a52061d86 Update afterFind() callback signature to be PHP5.4+ compliant. 2013-09-10 14:15:01 -03:00
Ber Clausen
867d4b312d Update afterSave() callback signature to be PHP5.4+ compliant. 2013-09-09 21:34:11 -03:00
Ber Clausen
c524645738 Update Model/Behaviors callback signature to be PHP5.4+ compliant. 2013-09-05 11:17:02 -03:00
Kim Egede Jakobsen
63dfbe55f7 Added/removed newlines to make the code more readable. 2013-09-01 12:09:14 -07:00
Kim Egede Jakobsen
09bdad6ceb Reduce variable use/duplicate code. 2013-09-01 12:08:48 -07:00
Kim Egede Jakobsen
b64c7e3e84 Remove the $state === 'after' condition.
Can only be before / after.
2013-09-01 11:06:45 -07:00
mark_story
0f2d59d987 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Network/CakeResponse.php
	lib/Cake/TestSuite/CakeTestCase.php
2013-08-18 23:10:08 -04:00
mark_story
675f828e16 Remove insertQuery and deleteQuery.
These properties were never implemented and are misleading when people
try to use them.

Closes #3997
2013-08-18 21:37:37 -04:00
euromark
6cf147e8c8 unify null checks - avoid method call in favor of strict check 2013-08-16 20:12:49 +02:00
euromark
fc2d28974b remove undocumented code and uncessary in_array() checks + cleanup 2013-08-08 03:56:58 +02:00
ADmad
38b050a711 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Console/Command/ConsoleShell.php
2013-08-04 19:26:55 +05:30
ADmad
473e4f991f Fixed bug when using multi model fieldList and whitelists for all models are not provided.
Fixes #3948
2013-08-03 02:49:41 +05:30
ADmad
d161b21ae1 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Controller/Component/AuthComponent.php
2013-07-14 10:58:55 +05:30
euromark
a643295e4c remove @access and unnecessary $name 2013-07-08 15:50:50 +02:00
ADmad
4ded269549 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Controller/Component/Auth/BlowfishAuthenticate.php
	lib/Cake/VERSION.txt
2013-07-07 12:22:12 +05:30
euromark
e7f380d2b7 doublespace to single space 2013-07-05 14:36:40 +02:00
mark_story
c597855fe4 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Test/Case/Network/CakeRequestTest.php
2013-07-03 14:21:09 -04:00
euromark
f389435bae coding standards and else block simplification 2013-07-03 19:27:17 +02:00
euromark
7cb19b97db coding standards and simplification of else cases as well as some minor fixes 2013-07-03 00:52:48 +02:00
ADmad
12da3b1f27 Merge branch 'master' into 2.4 2013-06-16 13:07:44 +05:30
Thom Seddon
305b3f4688 Unify modified/created times
The former implementation meant that it was not guarantee that
the times automatically generated for the modified/created fields
would be exactly the same for a given operation.
2013-06-12 13:51:56 +01:00
Pafu Inlu
08cef539f9 Update Model.php
fixed comment spacing
2013-06-08 05:53:35 -06:00
Pafu Inlu
089c9e1139 Added a clear() function to Model.php (2.4 branch)
1.) Changed Pull Request from master branch to 2.4 (Old Pull Request: https://github.com/cakephp/cakephp/pull/1323)

2.) Updated return value in comment
2013-06-04 15:59:54 -06:00
ADmad
3303a2cda1 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Console/Templates/skel/Config/Schema/db_acl.php
	lib/Cake/Console/Templates/skel/Config/Schema/i18n.php
	lib/Cake/Console/Templates/skel/Config/Schema/sessions.php
	lib/Cake/Console/Templates/skel/Config/acl.ini.php
	lib/Cake/Console/Templates/skel/Config/acl.php
	lib/Cake/Console/Templates/skel/Config/bootstrap.php
	lib/Cake/Console/Templates/skel/Config/core.php
	lib/Cake/Console/Templates/skel/Config/database.php.default
	lib/Cake/Console/Templates/skel/Config/email.php.default
	lib/Cake/Console/Templates/skel/Config/routes.php
	lib/Cake/Console/Templates/skel/Console/Command/AppShell.php
	lib/Cake/Console/Templates/skel/Console/cake.bat
	lib/Cake/Console/Templates/skel/Console/cake.php
	lib/Cake/Console/Templates/skel/Controller/AppController.php
	lib/Cake/Console/Templates/skel/Controller/PagesController.php
	lib/Cake/Console/Templates/skel/Model/AppModel.php
	lib/Cake/Console/Templates/skel/View/Errors/error400.ctp
	lib/Cake/Console/Templates/skel/View/Errors/error500.ctp
	lib/Cake/Console/Templates/skel/View/Helper/AppHelper.php
	lib/Cake/Console/Templates/skel/View/Layouts/Emails/html/default.ctp
	lib/Cake/Console/Templates/skel/View/Layouts/ajax.ctp
	lib/Cake/Console/Templates/skel/View/Layouts/default.ctp
	lib/Cake/Console/Templates/skel/View/Layouts/error.ctp
	lib/Cake/Console/Templates/skel/View/Layouts/flash.ctp
	lib/Cake/Console/Templates/skel/View/Pages/home.ctp
	lib/Cake/Console/Templates/skel/index.php
	lib/Cake/Console/Templates/skel/webroot/index.php
	lib/Cake/Console/Templates/skel/webroot/test.php
2013-06-02 18:03:59 +05:30
Marc Würth
4c9f0414cb Improved the DocBlocks and other code cleanup
Fixed @license tag, url comes first
Whitespace and other minor code cleanup
Added some docblocks
2013-05-31 00:11:19 +02:00
Marc Würth
2bbd391972 Synced PHP version annotations
CakePHP seems to be just "PHP 5" as opposed to the PEAR header comment standard "PHP version 5"
http://pear.php.net/manual/en/standards.header.php
2013-05-29 20:19:14 +02:00
Damien Biasotto
e1c27af9e9 Fix typo variable name in _deleteDependent().
It's not a big deal but there was a typo in _deleteDependent() method. 

$savedAssociatons instead of $savedAssociations.
2013-05-29 14:25:39 +03:00
mark_story
72b75660e5 Merge branch 'master' into 2.4 2013-05-16 21:31:27 -04:00
ADmad
4d434ec9f3 Fix CS errors 2013-05-13 23:51:32 +05:30
ADmad
19f8274a95 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/VERSION.txt
2013-04-25 03:06:04 +05:30
mark_story
62660c6706 Re-assign $db after beforeSave.
This allows model/behavior methods to change the datasource in the
beforeSave callback. If you use drivers from different SQL platforms
things will go very poorly.

Fixes #3606
2013-04-21 21:15:44 -04:00