Commit graph

287 commits

Author SHA1 Message Date
mark_story
638d2ea7b6 Add array cast for method_cache data.
Fixes #4186
2014-09-02 22:39:28 -04:00
chinpei215
31204832c2 Ensure that afterFind is called when using 'joins' with 'recursive' = -1 2014-08-27 15:16:13 +09:00
chinpei215
b74774bb0c hasOne/belongsTo associations should contain associated records in afterFind
Before 1fe943d6f1,
afterFind() is called twice with belongsTo/hasOne associations.
Although $results also doesn't contain associated records on first time,
it contains them on second time.

After 1fe943d6f1,
it doesn't work if associated records are used in afterFind.
This commit fixes it.
2014-08-27 09:32:00 +09:00
mark_story
d114fa1431 Update join building to not error out on empty conditions.
When conditions are empty we can assume one of two things:

* The person made a mistake.
* The person is doing the join conditions in the where clause.

In both cases we should attempt to generate proper SQL.

Fixes #4189
2014-08-08 10:02:09 -04:00
chinpei215
1fe943d6f1 Fix afterFind() called twice with belongsTo and hasOne relationships
Refs #2268
2014-08-06 07:27:04 +09:00
Anthony GRASSIOT
aa42b80a4d a / an typo fixes fot API 2014-07-30 22:11:03 +02:00
chinpei215
ace30fdd8a Fix a race condition problem
Prevents Model::save() from generating a query with WHERE 1 = 1 on race condition.

Refs #3857
2014-07-12 23:27:39 +09:00
euromark
974ca851c2 Correct doc blocks according to cs guidelines.
Remove superfluous empty lines.
2014-07-03 15:36:42 +02:00
mark_story
33a5b6e451 Fix additional missing API doc tags. 2014-07-02 23:38:34 -04:00
Kenshin Okinaka
91cb3ddc27 Unset $db in DboSource::read().
After calling $db->queryAssociatin(), it is necessary to unset db. 
This reverts commit 52d425737a.
2014-05-13 21:17:34 +09:00
ADmad
d466e00644 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
	lib/Cake/Test/Case/Model/Datasource/Database/MysqlTest.php
	lib/Cake/Utility/Folder.php
	lib/Cake/VERSION.txt
2014-05-04 14:35:36 +05:30
euromark
7a287a6942 More coding standard corrections. 2014-04-29 14:19:33 +02:00
euromark
8e0f15b3d6 Revert the removal of a BC relevant part. 2014-04-10 20:11:58 +02:00
mark_story
2fe8c4050b Insert manual joins *after* generated joins.
Re-order query joins to make manually added joins be performed after
generated joins. This removes the need to workaround the current join
order, or redefine all association joins when you want to add an
additional join on a leaf table.

Refs #2179
Refs #2346
2014-03-23 21:09:08 -04:00
mark_story
8acb75425d Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Datasource/DboSource.php
2014-03-21 22:55:28 -04:00
James Watts
2eadb89ff6 Update in_array() check to avoid fatal error
Enabling the $strict parameter to true avoids PHP's default behavior when search for an array in an array, which throws a fatal error if circular references exist - http://php.net/in_array#refsect1-function.in-array-parameters
2014-03-21 16:16:32 +01:00
mark_story
3a226b03c3 Remove typehint from generateAssociationQuery()
While I think typehints are generally a good idea, this one broke a few
plugins, notably CakeDC/search. I don't think it is wise for 2.X release
to break BC in that way. I think reverting this change is probably the
safest path right now.
2014-03-12 23:42:21 -04:00
mark_story
5a944734b8 Remove typehint on $LinkModel argument.
Adding a typehint here causes errors in a few userland plugins. We
should honor the previous interface as best we can.
2014-03-12 23:30:46 -04:00
mark_story
2c5d96e916 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Datasource/DboSource.php
2014-02-16 14:24:19 -05:00
mark_story
a5d50da040 Remove dead and unused code. 2014-02-11 16:38:24 -05:00
Ber Clausen
f30b43b4c9 Update documentation and typehint. 2013-12-21 22:02:45 -03:00
Ber Clausen
c15f7de164 Re-expose DboSource::fetchAssociated() for BC.
Internally use protected methods to fetch hasMany and hasAndBelongsToMany
associations.
2013-12-21 11:34:40 -03:00
Ber Clausen
5ccb77e25d Be consistent with the result set variable name. 2013-12-21 10:57:40 -03:00
Ber Clausen
0adc062cfa Process query only when needed. 2013-12-21 10:57:40 -03:00
Ber Clausen
422be67a03 Avoid recalculating whether the relationship is a self join. 2013-12-21 10:57:40 -03:00
Ber Clausen
86b69964ef Be more semantic with variable names.
Isue less loockups for deep arrays.
A bit of documentation added.
2013-12-21 10:57:40 -03:00
Ber Clausen
7a378c3b22 Conveniently fetch hasAndBelongsToMany associations from within a function (like hasMany).
Variable names should represent their values.
Remove unnecessary references.
2013-12-21 10:57:38 -03:00
Ber Clausen
60a8f0900b Get Model associations only when needed. 2013-12-21 10:49:22 -03:00
Ber Clausen
8355d32bb1 Be more semantic indicating that association fields must be empty. 2013-12-21 10:49:22 -03:00
Mark Story
99c8503578 Merge pull request #2518 from bar/2.5-dbosource-getconstraint
Document DboSource::getConstraint().
2013-12-21 05:43:52 -08:00
Ber Clausen
5860cd4b8e Still more documentation. 2013-12-21 07:04:45 -03:00
Ber Clausen
c5c8cb80ba Document DboSource::getConstraint().
Also, update the function signature (to be compliant with other
functions) and type hint $LinkModel.
2013-12-21 06:24:23 -03:00
Ber Clausen
09188cc3d0 More documentation. 2013-12-21 06:11:31 -03:00
Ber Clausen
c1cdf190e3 Add documentation. Strict check. 2013-12-21 05:41:23 -03:00
Ber Clausen
1bdb783f91 Update documentation. 2013-12-21 05:39:42 -03:00
mark_story
7e5c0f7185 Merge branch 'master' into 2.5 2013-12-20 14:15:35 -05:00
mark_story
df4b978ce4 Clarify the docs for DboSource::fetchAll()
Refs #2508
2013-12-19 17:39:44 -05:00
Ber Clausen
2d67604182 Add more Model type hints, and ease the model testing replacing is_object() for '!== null'. 2013-12-10 00:20:12 -03:00
Ber Clausen
63a192ea39 Update DboSource::group():
* Update documentation.
* Add Model type hint.
* Bail early when fields are empty.
2013-12-10 00:18:19 -03:00
Ber Clausen
5c595b90d2 Remove is_object() calls when the test subject is already type hinted as a Model. 2013-12-10 00:18:18 -03:00
Ber Clausen
2f24de81cb Model objects should be in CamelCase.
Add a Model type hint.
2013-12-10 00:18:18 -03:00
Mark Story
19122414fc Merge pull request #2459 from bar/2.5-patch
Test for self join only when needed.
2013-12-09 18:55:31 -08:00
Ber Clausen
b7527c6c3b Test for a self join only when needed. 2013-12-09 23:11:42 -03:00
Ber Clausen
2366e7c7b5 Make getConstraint() a tiny bit more readable. 2013-12-09 22:25:03 -03:00
mark_story
97ab2c0e9b Merge branch 'imsamurai-2.5' into 2.5
Add unsigned integer support to MySQL. Unsigned integers have not been
added to other databases as they either do not support them (postgres,
sqlserver) or they are 'faked' and don't do anything (sqlite).

Fixes #2321
2013-11-27 20:12:28 -05:00
José Lorenzo Rodríguez
df5fc2304a Merge pull request #2289 from bar/2.5-optimize-dbosource
First part of the DboSource cleanup.
2013-11-21 01:02:36 -08:00
ADmad
dda6080579 Merge branch 'master' into 2.5 2013-11-19 00:27:12 +05:30
imsamurai
7bc8dac453 fix phpcs errors 2013-11-14 02:19:41 +02:00
imsamurai
2fcb4c3c6c - change check to strict for options of $fieldParameters
- add `types` parameter and strict check if it present in `$fieldParameters` (if it present and not contain column type field parameter will be skipped)
- add `noVal` parameter to `$fieldParameters` if it present and not empty value of this parameter from column will be ignored
- add `unsigned` column type for integer, float and biginteger. If it set to `true` an 'UNSIGNED' will be add in sql column part, if not set or set not to `true` this parameter will be skipped
2013-11-14 01:11:30 +02: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