Commit graph

610 commits

Author SHA1 Message Date
Thomas von Hassel
1c0b6c076a Update afterSave to ensure created entires have all translated fields present
Without all fields being present, find() will be unable to find the
translated records.

Fixes #3009
2012-07-07 12:03:29 -04:00
mark_story
eb7b66b37c Revert default value of allowEmpty.
In 2.1, the default value was null, which does not impart any behavior.
In 2.2 this was changed to false, which makes it hard to validate ''
with validation methods.  Move some tests around and update tests that
probably should have been failing before.

Fixes #2983
2012-06-24 20:06:14 -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
60c611fa47 Parse rules in getField() 2012-06-20 14:54:32 +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
mark_story
f625742a12 Make CakeSession use httponly by default.
Fixes #2955
2012-06-12 22:10:55 -04:00
Kyle Robinson Young
54745aada9 Fix custom validation methods with CakeValidationSet 2012-06-11 23:28:45 -07:00
mark_story
f3464b002f Remove duplicate code.
Use a shutdown function to close the session off.
This removes a bit of icky code and continues to allow
objects to be used as session handlers.
2012-06-06 21:01:16 -04:00
Jose Lorenzo Rodriguez
51635c2ca6 Merge remote-tracking branch 'origin/2.1' into 2.2
Conflicts:
	lib/Cake/Model/Model.php
	lib/Cake/Test/Case/Model/ModelValidationTest.php
2012-06-06 11:06:06 -04:30
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
e5eb7b490e Preventing cache collisions by adding the the datasource key 2012-06-01 10:42:26 +01:00
Jelle Henkens
18b335a605 Replacing crc32 with md5 for less collisions in method caching 2012-06-01 10:42:26 +01:00
mark_story
55c4ad3c1c Fix coding standards errors.
Also remove count() calls in TreeBehavior.
2012-05-31 21:20:11 -04:00
mark_story
9a8ceaeba6 Merge branch '2.1' into 2.2
Conflicts:
	lib/Cake/Test/Case/View/XmlViewTest.php
2012-05-30 21:20:56 -04:00
mark_story
0bfcd49249 Fix unbindTranslation not unbinding.
There were documented use cases that have never worked.  Fix that.
Also rename a method so it better describes what it does.

Fixes #2913
2012-05-27 21:25:55 -04:00
mark_story
115b2c1495 Rename joined to _joined to hopefully prevent issues. 2012-05-27 20:43:15 -04:00
Majna
ce2fc6c83d Improve belongsTo and hasOne for unneeded queries when recursive > 1.
Reuse already joined data for 'belongsTo' and 'hasOne' associations instead of running unneeded queries for each record.
Fixes #47
2012-05-27 23:15:20 +02:00
mark_story
4b8c469004 Merge branch '2.1' into 2.2
Conflicts:
	lib/Cake/VERSION.txt
2012-05-26 21:11:36 -04:00
mark_story
b27a3aab7b Set session.gc_maxlifetime by default.
In the default case of using files for sessions, files could
be garbage collected earlier than expected based on other session
settings.  Always set session.gc_maxlifetime so session files are
garbage collected correctly.

Fixes #2901
2012-05-23 22:25:19 -04:00
mark_story
ea9eee4c77 Fix array arguments being translated.
Fixes #2902
2012-05-23 21:02:41 -04:00
Jelle Henkens
ecd869d4e3 Changing int to integer 2012-05-22 16:34:07 +01: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
9cceb1553f Improving ModelValidator::add() to allow multiple rules to be defined at once 2012-05-20 18:51:00 -04:30
mark_story
16a1a0ee79 Fix coding standards. 2012-05-20 15:51:09 -04: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
dc8c731ccb Fixed failing test case 2012-05-19 19:59:32 -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
Jelle Henkens
dbd826f794 Removing extra space in the extract() calls 2012-05-13 10:37:50 +01:00
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
217bf85537 Implemented new method isEmptyAllowed in CakeValidationRule 2012-05-10 23:13:45 -04: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
efc3536adb Fixing a couple errors introduced in previous commit 2012-05-10 22:04:55 -04:30
Jose Lorenzo Rodriguez
2b7c2ad691 Fixing doc blocks for CakeValidationRule and changing visibility for some methods 2012-05-10 21:51:54 -04:30
Jose Lorenzo Rodriguez
34531d9d7c Cahnging doc in header for CakeValidationSet 2012-05-10 21:41:42 -04:30
Jose Lorenzo Rodriguez
c4202b7b22 Improving docs for CakeValidationSet 2012-05-10 21:39:53 -04:30
Jose Lorenzo Rodriguez
8c9c6b4a5a Improving docs for ModelValidator 2012-05-10 21:27:01 -04:30
Jose Lorenzo Rodriguez
280893155a Renaming CakeRule to CakeValidationRule 2012-05-10 21:01:44 -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
mark_story
d9bf3cf987 Fix additional issues with saveAll().
Fixes #2857
2012-05-10 20:55:46 -04:30
mark_story
8334ebebed Fix saving translate records with saveAll()
Also fixes issues saving translated data with validation
disabled.  By enabling data backup in beforeSave() and beforeValidate()
the existing behavior is preserved, and the current issue is fixed.

Fixes #2857
2012-05-10 20:55:45 -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
AD7six
8060dd57d3 don't dump indexes all on the same line 2012-05-09 23:38:30 +02:00
AD7six
0c4613fdd2 prevent NULL in fixture files 2012-05-09 23:38:29 +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
mark_story
fbba3621b5 Fix additional issues with saveAll().
Fixes #2857
2012-05-07 21:36:28 -04: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
Jose Lorenzo Rodriguez
d4511af27b Implemented add and remove in ModelValidator 2012-05-06 23:06:28 -04:30
Jose Lorenzo Rodriguez
a7222bccd6 Implemented removeRule in CakeValidationSet 2012-05-06 22:30:07 -04:30
mark_story
6c5255ac73 Fix saving translate records with saveAll()
Also fixes issues saving translated data with validation
disabled.  By enabling data backup in beforeSave() and beforeValidate()
the existing behavior is preserved, and the current issue is fixed.

Fixes #2857
2012-05-06 22:48:15 -04:00
Jose Lorenzo Rodriguez
1ff1af35b3 Fixing typo 2012-05-06 20:45:50 -04:30
Jose Lorenzo Rodriguez
ff91a0909a Implemented countable interface for CakeValidationSet 2012-05-06 01:07:13 -04:30
Jose Lorenzo Rodriguez
989a8b8398 Implementing IteratorAggregate for CakeValidationSet 2012-05-05 21:13:09 -04:30
Jose Lorenzo Rodriguez
6f16a66b83 Implmenting ArrayAcces in CakeValidationSet 2012-05-05 21:00:40 -04:30
Jose Lorenzo Rodriguez
877e6c0f66 Removing the need for first param in CakeRule constructor 2012-05-05 19:41:48 -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
3199b9029b Implemented countable interface for ModelValidator 2012-05-05 17:46:09 -04:30
Jose Lorenzo Rodriguez
81c0c3d91d Implementing IteratorAggregate interface for ModelValidator 2012-05-05 17:34:35 -04:30
Jose Lorenzo Rodriguez
d35f8e6b00 Implementing ArrayAccess in ModelValidator 2012-05-05 15:52:02 -04:30
Jose Lorenzo Rodriguez
b6c8a345e7 Renaming CakeField to CakeValidationSet 2012-05-05 13:44:12 -04:30
Jose Lorenzo Rodriguez
843d95bb77 Renaming some methods ands removing others 2012-05-05 13:34:14 -04:30
mark_story
128c719bd0 Add no-op method to base class.
Fixes #2839
2012-04-30 20:52:17 -04:00
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
05abff6ecd Fixing faling test case 2012-04-29 19:58:22 -04:30
Jose Lorenzo Rodriguez
72e8992c25 Improving test coverage for CakeRule 2012-04-29 19:56:24 -04:30
Jose Lorenzo Rodriguez
d348bf6807 Refactoring again CakeRule, making all tests pass 2012-04-29 18:11:51 -04:30
Jose Lorenzo Rodriguez
94040859b2 Correctly calling method to not depend on functon call order 2012-04-29 02:57:10 -04:30
Jose Lorenzo Rodriguez
deedd7a3ce Even more tests passing now, almost there 2012-04-29 02:40:08 -04:30
Jose Lorenzo Rodriguez
8700f3c7a2 Fixed some validation tests 2012-04-29 01:06:24 -04:30
Jose Lorenzo Rodriguez
18c26119f3 Removing redundant code, cleaning up some sentences 2012-04-29 00:39:43 -04:30
Jose Lorenzo Rodriguez
c31f87b7a1 Refactored getMethods, got rid of validationErrors property in ModelValidator, made validateAssociated and many tests
pass
2012-04-29 00:24:35 -04:30
Jose Lorenzo Rodriguez
b83f936e83 General refactor on ModelValidation to decrease class coupling and increase readability 2012-04-28 23:25:05 -04:30
Jose Lorenzo Rodriguez
573d292ffa Fixed more refereces to old method 2012-04-28 20:12:20 -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
f54eb0cdee following coding standards and simplifying some logic 2012-04-28 19:38:18 -04:30