Commit graph

264 commits

Author SHA1 Message Date
ADmad
33a879ff41 Fix find('count') with 'group' when result has only one group. Closes #1677 2012-10-09 10:43:27 +05:30
dogmatic69
408e619c9f Merge branch '2.3' into type-checks
Conflicts:
	lib/Cake/Console/Command/Task/ModelTask.php
	lib/Cake/Controller/Component/RequestHandlerComponent.php
	lib/Cake/Model/Datasource/Database/Mysql.php
	lib/Cake/Utility/CakeNumber.php
2012-10-01 02:08:00 +01:00
mark_story
59e948fb1b Merge branch 'master' into 2.3 2012-09-28 21:20:24 -04:00
James Michael DuPont
2d46fc60be Fixing undefined variable usage
Squash of pull request #872
2012-09-28 20:46:25 -04:00
euromark
b7f1740d2b correcting coding-standards 2012-09-28 13:49:51 +02:00
Jose Lorenzo Rodriguez
d5c9d97dc1 Merge remote-tracking branch 'origin/master' into 2.3
Conflicts:
	lib/Cake/Model/Behavior/TranslateBehavior.php
	lib/Cake/Model/CakeSchema.php
	lib/Cake/Utility/CakeTime.php
	lib/Cake/Utility/ClassRegistry.php
	lib/Cake/View/MediaView.php
2012-09-25 16:36:03 +02:00
dogmatic69
8dc4de5de8 converting if ($foo != false) to if ($foo) 2012-09-21 23:32:52 +01:00
dogmatic69
b1f26b59a3 converting if ($foo != null) to if ($foo) 2012-09-21 23:30:43 +01:00
dogmatic69
6d4f4b57d7 adding a plugin propery to models wwith tests for ticket #85
Merge pull request #696
2012-09-20 21:31:31 -04:00
dogmatic69
22a2e1b51e converting $foo == / $foo == 0 to !$foo (and a few $foo === 0) 2012-09-14 18:42:25 +01:00
dogmatic69
cf8fccae96 converting $foo == null / $foo == false to !$foo 2012-09-14 18:26:30 +01:00
mark_story
7d2cbec79d Revert "Fix null not stopping model callbacks."
This reverts commit 82a8400def.

The previous change broke a number of tests as existing tests expect
that a return value of null will not stop events.
2012-09-13 22:49:17 -04:00
mark_story
82a8400def Fix null not stopping model callbacks.
Add a compatibility shim into CakeEventManager to fix `null` not
breaking model callbacks.  This was a regression created when model
callbacks were re-factored to use the event manager. This code should be
removed in 3.x as its inconsistent with events used everywhere else in
the framework.

Fixes #3123
2012-09-13 22:11:46 -04:00
Kyle Robinson Young
bc40ac7d3f Remove unused variables and code 2012-09-05 17:19:13 -07:00
Ceeram
cb80338c7d avoid duplication in return value when saving habtm 2012-08-24 00:50:46 +02:00
Ceeram
c5ebbc991c Revert "Merge pull request #784 from ceeram/habtmmerge"
This reverts commit fa5aa6278f, reversing
changes made to 88604ac757.
2012-08-23 16:00:41 +02:00
Ceeram
fb0053753e avoid duplication in returned results for habtm 2012-08-22 13:03:47 +02:00
mark_story
cffc36e4e0 Fix notice error when impossible conditions are created.
Fixes #3084
2012-08-01 23:05:56 -04:00
mark_story
5e54be4e5a Merge branch '2.1' into 2.2
Conflicts:
	lib/Cake/Error/exceptions.php
2012-06-23 16:41:32 -04:00
Ceeram
b913fe5303 better error message in MissingConnectionException when driver is not enabled 2012-06-23 11:42:26 +02:00
Ceeram
71112d1225 No need to create new instance of ModelValidator when one is already created 2012-06-20 14:57:56 +02:00
Ceeram
03e2263b69 Merge branch '2.1' into 2.2 2012-06-19 18:35:36 +02:00
Ceeram
cf18e8d38b avoid unneeded query in delete() 2012-06-19 16:08:36 +02:00
Ceeram
0df1e90eed show all validation errors when saving/validating Associated and primary model fails validation as well, fixes #2925 2012-06-18 14:20:53 +02:00
Jose Lorenzo Rodriguez
111a23274e Fixing yet another issue related to beforeValidate and
validateAssociated
2012-06-06 10:07:01 -04:30
Ceeram
4c6453501e Merge branch '2.1' into 2.2 2012-06-02 01:47:21 +02:00
Ceeram
048dc8d254 casting schema to array, fixes error for array_keys when return is null 2012-06-02 01:39:53 +02:00
Jelle Henkens
f7ce5262b7 Updating mixed @param documentation to seperate list of accepted types 2012-05-21 21:55:10 +01:00
Jose Lorenzo Rodriguez
2ad406ab64 Merge branch '2.2-validator' into 2.2
Conflicts:
	lib/Cake/Model/Model.php
	lib/Cake/Test/Case/Model/ModelValidationTest.php
2012-05-20 14:27:35 -04:30
mark_story
ad31caeb0e Merge branch '2.1' into 2.2 2012-05-20 14:53:41 -04:00
Jose Lorenzo Rodriguez
16847b0d97 Backporting changes form 2.2 to fix some edge cases on deep saving. Fixes #2879 2012-05-19 21:14:23 -04:30
Jose Lorenzo Rodriguez
b22c50d8b6 Merge branch '2.1' into 2.2-validator
Conflicts:
	lib/Cake/Model/Model.php
	lib/Cake/Test/Case/Model/ModelValidationTest.php
	lib/Cake/Test/Case/Model/models.php
2012-05-19 15:39:44 -04:30
Ceeram
7dbd6bc3a2 make sure model data is moved to alias, even when first key in data is assoc model
add extra tests for saveAll and validate first
ensure db values dont get reset to default values
2012-05-19 14:41:16 -04:30
ADmad
eeff950cf9 Removing default null value for $data parameter. Refs GH pull request #646 2012-05-12 00:18:47 +05:30
Jose Lorenzo Rodriguez
785cf8354c Fixing merge artifacts to make all tests pass 2012-05-10 22:36:55 -04:30
Jose Lorenzo Rodriguez
307197da9e Merge branch '2.2' into 2.2-validator
Conflicts:
	lib/Cake/Model/Model.php
	lib/Cake/Test/Case/Model/ModelValidationTest.php
	lib/Cake/Test/Case/Model/ModelWriteTest.php
2012-05-10 22:19:35 -04:30
Jose Lorenzo Rodriguez
f06fbb0075 Making validateAssociated overwrite data consistently with validateMany 2012-05-10 20:55:47 -04:30
Jose Lorenzo Rodriguez
82e87791f6 Ugly hack to fix saveAll deep and beforeValidate callbacks changing model data 2012-05-10 20:55:47 -04:30
Jose Lorenzo Rodriguez
1481f82ec1 Added warning messages in doc block for validateMany and validateAssociated about first param being passed by reference 2012-05-10 20:55:47 -04:30
Jose Lorenzo Rodriguez
7db2b97f87 Fixing error with validateMany and validateAssociated not saving values altered in beforeValidate callbacks 2012-05-10 20:55:47 -04:30
Jose Lorenzo Rodriguez
e4c88d8cf9 Revert "Merge pull request #644 from nodesagency/hotfix/beforeValidate-copy-data"
This reverts commit 0f54758e5a, reversing
changes made to b4a42e4a03.
2012-05-10 20:55:47 -04:30
Jose Lorenzo Rodriguez
2cea668755 Revert "Merge pull request #643 from nodesagency/hotfix/beforeValidate-copy-data"
This reverts commit b4a42e4a03, reversing
changes made to 6bd7da36e7.
2012-05-10 20:55:46 -04:30
Christian Winther
ad4e46150a Fixing saveMany 2012-05-10 20:55:46 -04:30
Christian Winther
fbd2132300 Another fix for Pull request 642 2012-05-10 20:55:46 -04:30
Christian Winther
7a1275a1b1 Copy changes made to $this->data in beforeValidate callbacks back to saveAssociated data variable
This allow changes in beforeValidate to be saved
2012-05-10 20:55:46 -04:30
Jose Lorenzo Rodriguez
b54dc69f64 Making validateAssociated overwrite data consistently with validateMany 2012-05-10 00:52:54 -04:30
Jose Lorenzo Rodriguez
6da2fe8323 Ugly hack to fix saveAll deep and beforeValidate callbacks changing model data 2012-05-10 00:47:35 -04:30
Jose Lorenzo Rodriguez
00a34f14fe Added warning messages in doc block for validateMany and validateAssociated about first param being passed by reference 2012-05-10 00:07:05 -04:30
Jose Lorenzo Rodriguez
0fb025f6dc Fixing error with validateMany and validateAssociated not saving values altered in beforeValidate callbacks 2012-05-09 23:51:27 -04:30
Jose Lorenzo Rodriguez
12ae03b876 Revert "Merge pull request #644 from nodesagency/hotfix/beforeValidate-copy-data"
This reverts commit 0f54758e5a, reversing
changes made to b4a42e4a03.
2012-05-09 17:58:08 -04:30
Jose Lorenzo Rodriguez
07bf73e88f Revert "Merge pull request #643 from nodesagency/hotfix/beforeValidate-copy-data"
This reverts commit b4a42e4a03, reversing
changes made to 6bd7da36e7.
2012-05-09 17:57:48 -04:30
Christian Winther
e8fce37a65 Fixing saveMany 2012-05-09 23:59:02 +02:00
Christian Winther
3b154fa325 Another fix for Pull request 642 2012-05-09 23:34:37 +02:00
Christian Winther
45a86a8b20 Copy changes made to $this->data in beforeValidate callbacks back to saveAssociated data variable
This allow changes in beforeValidate to be saved
2012-05-09 22:57:21 +02:00
Jose Lorenzo Rodriguez
52c7b2383c Added afterValidate callback to maintain consistency across all other callbacks in the model layer 2012-05-06 23:38:29 -04:30
Kim Egede Jakobsen
d180f6c3e5 Changed some of the doc-block links.
!But think there is a mistake somewhere with the links!
Camel-case or lowercase?

doc block content -> working link
(Model.php)
\#useTable        -> \#usetable
\#displayField    -> \#displayfield
\#cacheQueries    -> \#cachequeries

\#sortByKey       -> \#sortByKey (equals - basic.php)
2012-05-06 01:44:27 +02:00
Jose Lorenzo Rodriguez
843d95bb77 Renaming some methods ands removing others 2012-05-05 13:34:14 -04:30
Jose Lorenzo Rodriguez
bf0f5ab118 Merge remote-tracking branch 'origin/2.1' into 2.2 2012-04-29 20:05:39 -04:30
Jose Lorenzo Rodriguez
4519ba1221 Fixed variable reference 2012-04-28 20:05:41 -04:30
Jose Lorenzo Rodriguez
3ea2d7bca5 Removing validatior construction in model constructor 2012-04-28 20:04:33 -04:30
Jose Lorenzo Rodriguez
8eb02d0539 Simplifying options for setting/getting a model validator. Adding loading support for validators is was simplified into
requiring custom validators to extend core ModelValidator
2012-04-28 19:20:22 -04:30
Tigran Gabrielyan
77f6d88a9e Fixed bug in model validation translate 2012-04-26 21:24:22 -07:00
Kyle Robinson Young
b8488b8dfe Update 1.x @link in docblocks 2012-04-26 19:49:18 -07:00
Ceeram
ec9966ec6b Adding tests for Validator 2012-04-25 09:38:58 +02:00
Thomas Ploch
324684c14f Moving all validation logic into a new ModelValidator object. 2012-04-25 08:53:31 +02:00
Ceeram
74ee75b0ef Merge branch '2.1' into 2.2 2012-04-23 10:34:04 +02:00
ADmad
b1e7164d1a Implemented translation of validation rule arguments in validation error messages. Closes #2816 2012-04-22 23:25:07 +05:30
Ceeram
f0bd7386e2 created, modified and updated fields now use static timestamp in testcases 2012-04-21 17:38:49 +02:00
mark_story
21ba5bf04a Merge branch '2.1' into 2.2 2012-04-17 21:47:24 -04:00
Ceeram
388b20dd9d fix error in previous commit 2012-04-17 00:22:13 +02:00
Ceeram
a84597784d avoid warning when saveAll() data has empty hasMany data, fixes #2792 2012-04-16 22:46:58 +02:00
Ceeram
9556ff714d Avoid running validation again, when saveAll() is called with 'validate' => 'first' 2012-04-16 09:45:44 +02:00
mark_story
d136fac219 Correct docs to match code.
Fixes #2790
2012-04-15 20:33:43 -04:00
Kyle Robinson Young
6cf73c763c Tests for a generic custom datasource
Default startQuote and endQuote to avoid error with non-database datasources
2012-04-11 10:08:45 -07:00
mark_story
9f9feec222 Merge branch '2.2-hash' into 2.2
Conflicts:
	lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
	lib/Cake/View/Helper/FormHelper.php
2012-04-10 21:32:37 -04:00
mark_story
8d1b5c3f24 Fix notice errors with postgres. 2012-04-07 17:22:27 -04:00
Ceeram
c2a8fca00c Merge branch '2.1' into 2.2
Conflicts:
	lib/Cake/Test/Case/Model/Datasource/DboSourceTest.php
2012-04-05 23:27:21 +02:00
Ceeram
30268f6a08 Only check for existing method expresion() when it actually will be called.
Datasources that use calculate() should not be forced to implement expression() as well
2012-04-05 23:15:18 +02:00
ADmad
7ed90c72ae Updating API docblock for Model::query() 2012-04-03 19:06:41 +05:30
mark_story
a76a926ac1 Fix more uses of Set -> Hash 2012-03-26 22:32:57 -04:00
mark_story
19e0d8d946 Switch usage to Hash where possible. 2012-03-26 22:32:53 -04:00
Ceeram
c9528b8446 Merge branch '2.1' into 2.2 2012-03-21 11:19:08 +01:00
Ceeram
4dfbfe9c8b fix saveAll deep option, when associated data is empty, or has deeper associated model data as first key in array 2012-03-21 10:38:04 +01:00
mark_story
c58b61c17b Merge branch '2.1' into 2.2
Conflicts:
	lib/Cake/Test/Case/Model/ModelWriteTest.php
2012-03-18 21:26:45 -04:00
ADmad
bdddc85946 Making option 'unique' => 'keepExisting' for HABTM association behave consistently with all acceptable data formats. 2012-03-18 13:43:21 +05:30
Juan Basso
c754fb2dcb Updated copyright to 2012. 2012-03-12 22:46:46 -04:00
Juan Basso
3b1bd90ad6 Updated copyright to 2012. 2012-03-12 22:46:07 -04:00
Ceeram
bbfaa9e947 Paginating now work well with custom find methods.
_findCount() will now pass $query['operation'] = 'count' for more flexibility.
Custom finders can distinguish the operation and return other $query if needed.
2012-03-11 15:14:50 +01:00
mark_story
664b0538b8 Fix more coding standards problems. 2012-03-04 22:49:38 -05:00
mark_story
9a6ad7e1e2 Fixing most coding standard issues in Model/ 2012-03-04 21:51:50 -05:00
Ceeram
08a4d0bf63 Avoid unsetting Model's $findMethods when defining a custom find method in AppModel, also add tests for custom finds 2012-03-03 23:55:03 +01:00
mark_story
7665f369fa Merge branch '2.1-type-hinting-corrections' into 2.1 2012-02-25 20:07:18 -05:00
euromark
e94d307ee1 code conventions 2012-02-25 19:46:05 -05:00
ADmad
4edb378ef8 Added ability to pass ID as parameter to Model::exists() 2012-02-24 19:42:23 +05:30
Mark Story
b7302850b5 Merge pull request #467 from tPl0ch/2.1-required-update-create
Added support for simplified required validation on 'create' or 'update'. Fixes #230.
2012-02-22 09:43:13 -08:00
Majna
0cd9a93e9e Remove unused variables and statements. 2012-02-17 21:10:43 +01:00
Majna
1dbafe1d4f Fix docblocks. 2012-02-17 13:51:20 +01:00
dogmatic69
3246cf7c1e adding the model alias so that there are no issues when the find has a join on it 2012-02-16 16:22:45 +00:00
Ceeram
bc07ba3839 Added option['deep'] to saveAll, to save unlimited levels associated data
Squashed commit of the following:

commit 45caa54e3b25bc94ee10d7b3700ff334e7994257
Author: Ceeram <c33ram@gmail.com>
Date:   Sun Feb 12 22:29:33 2012 +0100

    update docblocks for deep save

commit 6f3c3b9abf12e394262b0a233188a52095f64b50
Merge: 1d32698 1dd0ff1
Author: Ceeram <c33ram@gmail.com>
Date:   Sun Feb 12 18:17:34 2012 +0100

    Merge branch '2.1' into 2.1-saveAllTheThings

commit 1d32698640fa1a3c1d606eeaf4740637ff8a1991
Author: Ceeram <c33ram@gmail.com>
Date:   Sun Feb 12 18:16:57 2012 +0100

    Revert "adding info in docblock about associated model fieldList"

    This reverts commit 7cc10a2b5afc1007c388a6da449781dc351d50cd.

commit 7cc10a2b5afc1007c388a6da449781dc351d50cd
Author: Ceeram <c33ram@gmail.com>
Date:   Sun Feb 12 18:05:18 2012 +0100

    adding info in docblock about associated model fieldList

commit db2ad2759f6af460715a8bbee167262bcbb62d77
Author: Ceeram <c33ram@gmail.com>
Date:   Sun Feb 12 17:51:44 2012 +0100

    add tests for deep saveAll respecting fieldList option

commit 14123fccfc43fac1b4cddeea8350dca8fb9c9821
Merge: cfdf25d 2afb05b
Author: Ceeram <c33ram@gmail.com>
Date:   Sun Feb 12 16:51:26 2012 +0100

    Merge branch '2.1' into 2.1-saveAllTheThings

commit cfdf25d4b587c6f1a8cd6ec2bc46dc21fa3c6704
Author: Ceeram <c33ram@gmail.com>
Date:   Tue Feb 7 13:54:59 2012 +0100

    Make saveAllTheThings fully BC, use $options['deep'] = true, to save infinite recursive data

commit 6e8c4380c37a31efc2a37a5ab6438db26d293eb3
Merge: 203c7e1 95aa7e3
Author: Ceeram <c33ram@gmail.com>
Date:   Wed Jan 25 14:22:26 2012 +0100

    Merge branch '2.1' into 2.1-saveAllTheThings

commit 203c7e1d9870e282ec7098297d47e49132904401
Author: Ceeram <c33ram@gmail.com>
Date:   Wed Jan 25 14:19:25 2012 +0100

    validate all the things as well

commit d920d0000fcab80fc48a29b45dbba147a2eed27c
Merge: d648f6a 4f1be12
Author: Ceeram <c33ram@gmail.com>
Date:   Mon Jan 23 18:22:12 2012 +0100

    Merge branch '2.1' into 2.1-saveAllTheThings

commit d648f6a90419e0fa27ed1d9e9feb51c37fbf0397
Author: Ceeram <c33ram@gmail.com>
Date:   Fri Dec 9 15:11:52 2011 +0100

    making saveAll, saveMany and saveAssociated not limited to only save directly related models
2012-02-13 01:00:28 +01:00
ADmad
1dd0ff1701 Updating docblock 2012-02-12 22:11:55 +05:30