Commit graph

1479 commits

Author SHA1 Message Date
Brian Porter
4a0f42e179 Doc block capitalization corrections as requested. 2014-08-12 10:48:12 -05:00
Brian Porter
9b9600fe18 CakeSchema naming fallback.
Abstracts the `require_once` of the schema file so it can be done twice. The added second call is a fallback for the previous APP_DIR-based naming to provide backwards compatibility.

Removes now-obsolete CakeSchema tests that involved `Configure::read('App.dir')`. The CakeSchema::name is now always static (and predictable) in the default case.
2014-08-11 10:40:57 -05:00
Brian Porter
be9be48c46 More predictable default for CakeShema class naming.
Instead of using the `APP_DIR` constant, which may change between developer installations of a project and cause issues loading Schemas generated elsewhere, use a fixed string, 'App'.

This is related to CakeDC/migrations#184 and should fully resolve #4174.
2014-08-11 09:12:16 -05:00
chinpei215
c246695518 Fix different format of $results in afterFind
Refs #2529

As of this commit, we can get consistent format of $resutls in afterFind.
And we can keep backward compatibility if Model::$useConsistentAfterFind is set to false.
2014-08-11 01:19:40 +09:00
chinpei215
c227c14bf2 Fix afterFind() called twice with hasMany relationship
It occurs when a model and the children models are related to a same model.
For example, such as the following:

* User hasMany Comment
* User hasMany Article
* Article hasMany Comment
2014-08-11 00:12:03 +09:00
mark_story
9c3089796f Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/Model/Model.php
2014-08-08 23:28:06 -04: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
Mark S.
2471c64aae Merge pull request #4158 from dereuromark/master-cakesession-hotfix
Fix notice in CakeSession.
2014-08-06 18:25:55 +02:00
José Lorenzo Rodríguez
64e74cbaac Merge pull request #4175 from chinpei215/master-issue2268-fix
Fix afterFind() called twice with belongsTo and hasOne relationships
2014-08-06 10:48:45 +02:00
chinpei215
1fe943d6f1 Fix afterFind() called twice with belongsTo and hasOne relationships
Refs #2268
2014-08-06 07:27:04 +09:00
euromark
864f5e06f6 Fix notice in CakeSession. 2014-08-04 13:32:20 +02:00
chinpei215
cb376bf420 Add some more transaction tests
And remove 2 else clauses.
2014-08-03 22:34:11 +09:00
ADmad
713f430fc4 Merge branch 'master' into 2.6 2014-08-03 01:05:36 +05:30
chinpei215
799500ce6d Fix transactions do not get rollbacked in saveAssociated/saveMany
Refs #2849
2014-08-02 10:12:33 +09:00
Anthony GRASSIOT
aa42b80a4d a / an typo fixes fot API 2014-07-30 22:11:03 +02:00
Ceeram
02b8bce641 Fix cs error introduced after resolving merge conflict with master to 2.6 2014-07-21 14:01:43 +02:00
mark_story
051d78c1a5 Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/Model/Model.php
2014-07-16 23:11:58 -04: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
mark_story
03c2a8b722 Unify datetime column default values between MySQL and Postgres.
Datetime columns should have 'default' => null, in both Postgres and
MySQL.

Fixes #3837
2014-07-11 23:10:16 -04:00
mark_story
9fd1a51a52 Merge branch 'master' into 2.6 2014-07-10 14:39:32 -04:00
David Yell
79be5e6805 Update Model.php
Fixed the case on the link to the book, to match the anchor in the page.
2014-07-10 10:46:48 +01:00
mark_story
3a70d9c033 Merge branch 'master' into 2.6 2014-07-09 10:17:05 -04:00
Ceeram
a266a9493d minor optimisation, refs comments on 81875cfeb1 2014-07-04 17:25:41 +02:00
mark_story
765be87d88 Overwrite the schemaName property if it is not defined in the class.
If a model class does not define a schemaName we should use the
datasource's schemaName. We can assume that people using schemaName want
to lock the model onto a specific schema given the changes in #3210

Fixes #3720
2014-07-03 21:53:54 -04:00
ADmad
e410501791 Fix CS errors. 2014-07-03 23:13:55 +05:30
mark_story
2bcd817367 Merge branch 'master' into 2.6 2014-07-03 11:13:06 -04:00
euromark
974ca851c2 Correct doc blocks according to cs guidelines.
Remove superfluous empty lines.
2014-07-03 15:36:42 +02:00
mark_story
b1610c145e Merge branch 'master' into 2.6 2014-07-02 23:39:16 -04:00
mark_story
33a5b6e451 Fix additional missing API doc tags. 2014-07-02 23:38:34 -04:00
mark_story
91721244a4 Fix more doc block errors in lib/ 2014-06-27 22:58:34 -04:00
Mark Story
e9da7b8f80 Merge pull request #3596 from zeroasterisk/2.6
MySQL DbdSource alter field support 'after'
2014-06-25 23:10:29 -04:00
mark_story
a2673d8bf0 Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/Core/App.php
2014-06-25 09:22:10 -04:00
euromark
b3507b199a Update doc blocks regarding return $this 2014-06-25 00:06:51 +02:00
Anatoliy Petrovskiy
ad678e3988 improving acl perfomance 2014-06-23 13:51:52 +03:00
Anatoliy Petrovskiy
bb15271622 improving acl perfomance by adding indexes on acl tables and reorganization joins in getting acl node function 2014-06-20 20:49:02 +03:00
mark_story
8e14b2f807 Merge branch 'master' into 2.6 2014-06-11 23:05:59 -04:00
Bryan Crowe
d8b4c3967c Fix typo 2014-06-10 23:31:42 -04:00
ADmad
0b4ba0b049 Fix api docblocks for behaviors. 2014-06-10 00:38:44 +05:30
mark_story
146053c980 Update datasource API docs. 2014-06-06 14:06:32 -04:00
José Lorenzo Rodríguez
932bf47481 Merge pull request #3604 from Haititi/2.6-save-atomic
2.6 add 'atomic' option to "save()" API - delivery
2014-06-05 13:55:52 +02:00
ADmad
1d40f3e685 Fix API docblock CS errors. 2014-06-05 00:28:55 +05:30
Haithem BEN GHORBAL
31615ce415 add 'atomic' option to "save()" API
This commit adds a transaction context to 'save()' API in order to rollback
possible modifications done in some 'Model.beforeSave' listener callback.
This will allow cakephp 2.x to behave like 3.0 .
It uses try/catch to better handle transaction.
Previous save() API is renamed to protected _doSave() method.
A new save() method is created for transaction handling.
'atomic' option is disabled for internal 'save()' call.
2014-06-03 09:37:17 +02:00
mark_story
92eeef8ae0 Merge branch 'master' into 2.6 2014-06-02 22:57:25 -04:00
ADmad
e7debd8692 More API docblock CS fixes. 2014-06-02 18:27:11 +05:30
Stefan Dickmann
91907b5c6c correct docblock
invalid certificate domain
2014-06-01 13:23:47 +02:00
ADmad
3d9b2b80cb More API docblock fixes. 2014-06-01 03:06:05 +05:30
alan bount
c273ed8d2c MySQL DbdSource alter field support 'after'
The ALTER FIELD for MySQL should support 'after' just like the ADD FIELD
2014-05-29 11:06:44 -04:00
Haithem Ben Ghorbal
35c2a7ef31 restore previous (erroneous ?) behaviour 2014-05-29 02:36:13 +02:00
Haithem Ben Ghorbal
67af8b37db clean code and remove unneeded checks 2014-05-28 23:53:47 +02:00
Haithem BEN GHORBAL
d4a0883cb9 fix typo/coding style 2014-05-28 18:31:03 +02:00
Haithem BEN GHORBAL
a8e410ee20 fix save with habtm returning false 2014-05-28 18:17:16 +02:00
Mark Story
9c9d45596f Merge pull request #3478 from Schlaefer/#3303-lengthBetween
closes #3303 RFC: Rename Validator::between() into Validator::length()
2014-05-24 16:48:05 -04:00
mark_story
587f2da09e Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/VERSION.txt
2014-05-22 14:29:43 -04:00
mark_story
81875cfeb1 Optimize renew().
Don't call session_id() twice when we can use a local variable to store
the current session id.

Fixes #3531
2014-05-22 14:28:56 -04:00
mark_story
2e4d6eb009 Merge branch 'master' into 2.6
Conflicts:
	lib/Cake/VERSION.txt
2014-05-16 21:26:30 -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
Schlaefer
4848b63189 closes #3303 RFC: Rename Validator::between() into Validator::length() 2014-05-13 09:31:03 +02:00
mark_story
89cd114e6f Merge branch 'master' into 2.5 2014-05-12 14:30:02 -04:00
Coen Coppens
91fbbdf6ca Added $type as an argument.
See https://github.com/cakephp/cakephp/issues/2122
2014-05-12 12:08:06 +02:00
Stephen Cuppett
ed83df5bed Fixes #3469, explicit isset check for counterCache 2014-05-11 19:17:18 -04:00
Walther Lalk
2dd3cecfaa Fixes issue with Sql Server driver when loading fixtures
Sqlserver::describe is expecting a model object (Unlike other drivers which work with either a object or string). While this does work under normal conditions, it causes a "Trying to get property of non-object" notice when using fixtures. The same problem also causes the testLimitOffsetHack test to fail.

This change does a simple test to ensure that the $model variable is an object before trying to access a property of it. All SqlServer tests are now passing.
2014-05-06 12:43:36 +02: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
mark_story
de0062de77 Merge branch 'master' into 2.5 2014-04-25 22:10:02 -04:00
mark_story
9d19801cfa Clear data and validationErrors *after* calling clearCache().
Having both properties cleaned after clearCache() means that you can use
the model data in specialized clearCache() implementations.

Fixes #3386
2014-04-24 09:19:00 -04:00
mark_story
d54fbe6f60 Merge branch 'master' into 2.5 2014-04-18 22:13:56 -04:00
Mark Story
d2fa1b444f Merge pull request #3301 from ubermaniac/Sqlserver-trim
Trim $sql before checking for SELECT
2014-04-11 18:48:41 -04:00
Joseph Woodruff
9aeea2fcc3 Trim $sql before checking for SELECT 2014-04-11 15:25:07 -06:00
mark_story
bf9c3029cb Merge branch 'master' into 2.5 2014-04-10 20:51:49 -04:00
euromark
8e0f15b3d6 Revert the removal of a BC relevant part. 2014-04-10 20:11:58 +02:00
euromark
0ece694a75 microptimize options and default merge and other string key array merges 2014-04-08 01:25:14 +02:00
euromark
cb0ac6f9f3 Add a note to offsetSet() on why it cannot chain. 2014-04-06 22:59:18 +02:00
Joseph Woodruff
8536371501 Sqlserver Datasource how properly appends the schemaName prefix in the describe() method 2014-04-02 13:59:04 -06:00
Joseph Woodruff
d526fdadc1 Base model class no longer changes an already defined schemaName value 2014-04-02 13:58:29 -06: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
ADmad
961f9d7669 Merge branch 'master' into 2.5 2014-03-16 20:17:24 +05:30
Wouter van Dongen
5035613157 * Fixed bug where select query in deleteAll could return wrong table name.
PDOStatement::getColumnMeta (in mysql.php) sometimes returns the actual
table name when using a MySQL view with the distinct select query, and not
the alias table name. By returning the actual table name the records
could not be removed.
By the way PDOStatement::getColumnMeta is an experimental function,
perhaps it's better to avoid it.
2014-03-14 15:20:12 +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
fda242f000 Merge pull request #2961 from ovidiupruteanu/patch-3
Sqlserver->describe failing for models with a schemaName
2014-03-11 21:03:54 -04:00
mark_story
c5b6dda82f Merge branch 'master' into 2.5 2014-03-11 21:02:27 -04:00
Thomas Smith
4927cf6901 #2994, unnecessary calls to Model::__isset(null) 2014-03-10 10:16:32 -07:00
ovidiupruteanu
7b1086e632 Add missing spaces 2014-03-06 05:18:31 +02:00
ovidiupruteanu
56a3f093a1 Sqlserver->describe failing for models with a schemaName
When models have a schemaName set it was searching for TABLE_NAME = 'schema_name.table_name'.
Instead it should search for TABLE_NAME = 'table_name' AND TABLE_SCHEMA = 'schema_name'
2014-03-06 04:54:03 +02: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
96a37d5917 Fix temporary associations that replace fields not being restored.
When binding temporary associations, fields should be restored
in the afterFind as the association will have become unbound.

Fixes #2816
2014-02-11 21:56:05 -05:00
mark_story
a5d50da040 Remove dead and unused code. 2014-02-11 16:38:24 -05:00
ADmad
9de3418079 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Model/Permission.php
2014-02-11 18:17:59 +05:30
Eric Martins
2793dca671 Fix ApiGen errors 2014-02-07 18:29:54 -02:00
Jimmy Madon
fcd41e45a7 Clarified ACL node lookup failed error.
Original error was ambiguous in stating whether the ARO node lookup failed or the ACO node lookup failed.
2014-02-05 18:25:14 +00:00
mark_story
be8ebfc005 Merge branch 'master' into 2.5 2014-02-05 09:22:46 -05:00
José Lorenzo Rodríguez
e36c954da7 Merge pull request #2693 from ADmad/2.5-session-start
Don't start a session if it's known to be empty.
2014-02-01 04:08:48 -08:00
Rachman Chavik
59549b7ebe Fix: Changing boolean to integer for Postgres
Closes #2751, CakeDC/migrations#149
2014-01-31 15:14:20 +07:00
mark_story
c1ab6fa9d1 Merge branch 'master' into 2.5 2014-01-30 10:13:37 -05:00
joostdekeijzer
987187ef8c Fix #2721 in TranslateBehavior::beforeFind() supporting both Model::field('fieldname') and Model::read('fieldname') 2014-01-29 13:37:47 +01:00
Rachman Chavik
b83b59a9d7 Log errors instead of calling trigger_error() 2014-01-29 17:51:07 +07:00
ADmad
c093804b35 Merge branch 'master' into 2.5 2014-01-26 17:39:50 +05:30
mark_story
d7d8fc00d1 Check data with isset() before accessing it.
Don't blindly access data that may not exist.

Fixes #2712
2014-01-25 22:15:47 -05:00
ADmad
4407cdb010 Avoid code duplication. 2014-01-22 11:36:45 +05:30
ADmad
84932fcc4a Don't start a session if it's known to be empty.
If an app only reads/checks the session there's no need to start a
session to know that the read/checked session value is empty.

Fixes #1981
2014-01-22 01:17:16 +05:30
mark_story
55e1619c59 Fix issue with find(count) and TranslateBehavior.
Fixes #2667
2014-01-18 21:54:09 -05:00
mark_story
75dd2ff1fb Merge branch 'master' into 2.5 2014-01-16 15:20:40 -05:00
mark_story
3763350667 Add test for issue #2595
Fold conditions that did the same thing and add a test case.

Closes #2595
2014-01-06 21:21:13 -05:00
Raffaele
a4f138813b Return value if value are 0
Save correctly if the value is 0, but after the find is returned as an empty string.
2014-01-03 15:46:09 +01:00
mark_story
3cee3b0e99 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/VERSION.txt
2013-12-30 21:28:22 -05:00
Stephen Cuppett
ed749fdc97 Must double quote the schema name in query
Schema names with reserved words such as "create" will fail this query without double quotes. 

Attempted prepared statement with ? placeholder. This failed with the following CakePHP error:

Error: A Database connection using "Postgres" was missing or unable to connect.	
The database server returned this error: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "$1" LINE 1: SET search_path TO $1 ^
2013-12-29 21:43:56 -05:00
Rachman Chavik
c4f8289b53 Fix test by checking against an empty array instead of false 2013-12-27 12:37:39 +07: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
OKINAKA Kenshin
3433e10fbd Fix Postgres for bigint primary key. 2013-12-18 14:58:18 +09:00
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
mark_story
c2b8778ce8 Merge branch 'master' into 2.5 2013-12-14 17:45:49 -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
José Lorenzo Rodríguez
6358741944 Merge pull request #2449 from cakephp/fix-session-cyclic-error
Fixed error in CakeSession that would call start() in an infinite loop
2013-12-09 02:18:21 -08:00
mark_story
48d2618c62 Merge branch 'master' into 2.5
Conflicts:
	lib/Cake/Routing/Router.php
2013-12-08 21:25:59 -05:00
Jose Lorenzo Rodriguez
70d5c37834 Ensuring session is configured before trying to destory it 2013-12-08 13:44:16 +01: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
Jose Lorenzo Rodriguez
848a0ce217 Fiexed error in CakeSession that would call start() in an infinite loop
when the session is marked as invalid
2013-12-07 22:25:33 +01: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
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
edc6fc6701 Merge pull request #2379 from rspenc29/2.5
Added support for passing additional flags to mysql connection
2013-11-24 01:07:58 -08:00
Rob Spencer
b8e32dd2b3 Adding flags override to additional pdo drivers 2013-11-24 01:04:17 -05:00
Rob Spencer
cda9320e96 Added support for passing additional flags to mysql connection 2013-11-24 00:47:06 -05:00
mark_story
71312932e8 Merge branch 'master' into 2.5 2013-11-21 21:46:21 -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
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
imsamurai
f817beb8b6 change method public unsigned to protected _unsigned 2013-11-19 10:55:44 +02:00
ADmad
dda6080579 Merge branch 'master' into 2.5 2013-11-19 00:27:12 +05:30
imsamurai
8bcfe452da not add unsigned to not numeric fields, fix broken test, add new test 2013-11-17 23:10:53 +02:00
imsamurai
2f6122cb01 add unsigned property in Model::describe 2013-11-17 22:37:01 +02:00
imsamurai
00fb663f90 remove numeric from unsigned config 2013-11-17 21:23:13 +02:00
imsamurai
1d9ecc6c94 Merge upstream/2.5 into 2.5 2013-11-17 21:13:25 +02:00
mark_story
b6b8d83980 Remove non-portable data type from MySQL.
'numeric' is a non-portable type that is not supported by any other
database driver. Removing it now will prevent future problems.
2013-11-14 10:28:09 -05:00
imsamurai
f1a2c1a75c add decimal type for unsigned 2013-11-14 10:56:51 +02:00
imsamurai
7bc8dac453 fix phpcs errors 2013-11-14 02:19:41 +02:00
imsamurai
fd64d952b5 change position from afterDefault to beforeDefault during to wrong order, add test 2013-11-14 01:36:27 +02:00
imsamurai
e35823e72a fix tests, add numeric type for unsigned 2013-11-14 01:33:11 +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
Andy Dawson
d94c187adc Merge pull request #2305 from kimegede/docblock-construct-destruct-return-void
Docblock construct destruct remove @return
2013-11-13 01:44:35 -08:00
Ber Clausen
ed142d8c89 Add missing type hints. 2013-11-13 00:09:45 -03:00
Ber Clausen
0e74a0757a Keep insertQueryData() DRY, issue less lookups. Remove unused $assocData
and $LinkModel from the signature.
Model objects should be CamelCase.
2013-11-13 00:09:39 -03:00
Ber Clausen
52d425737a Call getDataSource() instead of the directly calling
ConnectionManager::getDataSource().
2013-11-12 03:38:47 -03:00
Ber Clausen
c1f3d9c274 Model objects should be in CamelCase. 2013-11-12 01:37:38 -03:00
Ber Clausen
014d2dd2d9 Remove 'self' key from getConstraint() calculations because it is not necessary anymore. 2013-11-12 01:30:57 -03:00
Ber Clausen
e658e071d1 Remove unused variable from the signature. 2013-11-12 01:17:11 -03:00
Ber Clausen
67a65663a7 Assign before actually using it. 2013-11-12 01:13:55 -03:00
Ber Clausen
026565033b Model objects variables should be CamelCase. 2013-11-12 00:49:06 -03:00
Ber Clausen
6b8a79be6d Remove reference from the signature. 2013-11-12 00:29:36 -03:00
Ber Clausen
cb42b056ac Remove the 'Line indented incorrectly' PHPCS error. 2013-11-12 00:08:39 -03:00
Ber Clausen
7f570f33e4 Unindent, and remove unnecessary getDataSource() call.
Also, objects should be CamelCase.
2013-11-12 00:01:18 -03:00
Ber Clausen
b35c9671ad Explicitly build SQL statements, calling buildAssociationQuery(). 2013-11-11 23:27:50 -03:00
Ber Clausen
f0fcaa1305 Improve generateAssociationQuery():
* bail early when $linkModel is Null (BC for now).
* move SQL fields warmup and SQL statement building to its own functions
 (it will payoff later improving self documentation and readability).
* make assignments and function calls only when needed (depending on the
 association type).
2013-11-11 23:27:50 -03:00
Ber Clausen
dcadfcbcab Remove inline assignment. 2013-11-11 23:27:50 -03:00
Ber Clausen
53c6df554c Remove unused $resultSet argument from generateAssociationQuery(). 2013-11-11 23:27:50 -03:00
Ber Clausen
5da05d9216 Remove unneeded test inside conditional. 2013-11-11 23:27:50 -03:00
Ber Clausen
f16695db5f Move variables to logical blocks.
Unindent to ease readability, and avoid assigning variables when
unneeded.
Free a little memory before entering to recursive intensive loops.
2013-11-11 23:27:50 -03:00
Ber Clausen
fdb4b11d0b Remove unnecessary call to getDataSource(). 2013-11-11 23:27:50 -03:00
Ber Clausen
c9e0131d6a Only generate query data for hasOne and belongsTo associations.
Avoid calling generateAssociationQuery():

* when the return value will never be usefull (True in this case)
* to avoid polluting $queryData with uneeded fields

Later, the SQL statement for the primary, and 'hasOne' plus 'belongsTo'
relationships, is built.
2013-11-11 23:27:50 -03:00
Ber Clausen
2532228844 Improve readability and optimize minimizing variable lookups. 2013-11-11 23:27:49 -03:00
mark_story
1f5d1eee98 Remove duplicated reference for behaviors in ClassRegistry
The 2nd key in the registry was to support persistModel which has long
since been removed. With this registry key not being used it can be
removed with reasonable safety.

Fixes #2306
2013-11-11 12:30:00 -05:00
Kim Egede Jakobsen
18e0dc95dd Remove @return from docblock (for __construct && __destruct methods) 2013-11-11 14:54:48 +01:00
mark_story
3561929be7 Merge branch 'master' into 2.5 2013-11-10 21:53:09 -05:00
José Moreira
b1e366c500 Model.php PHPDoc Description: Chang afterFilter with afterFind 2013-11-10 16:59:28 +00:00
mark_story
afd182898f Merge branch 'master' into 2.5 2013-11-01 16:54:57 -04:00
mark_story
9e4ac31dc3 Correctly identifier quote column names before adding them to queries.
Closes #2248
2013-10-31 19:53:42 -04:00
mark_story
aaac360833 Merge branch 'master' into 2.5 2013-10-30 14:58:20 -04:00
Zach Gambino
927a4933d1 Fix for #2247 | Use correct column when calculating next sequence value
See #2247 for more details.
2013-10-30 11:25:06 -07:00
mark_story
16be5722ba Fix COUNT(DISTINCT x) queries from getting corrupted in Sqlserver.
Add into the tower of hacks that is the SQL generation and stop breaking
COUNT(DISTINCT foo) style queries. Previously these would be converted
into DISTINCT COUNT(foo) which will give the non-distinct results.
2013-10-29 23:01:55 -04:00
mark_story
0f8dae55c9 Add missing trim() around Sqlserver queries.
This solves issues with queries failing.

Fixes #2222
2013-10-29 23:01:49 -04:00
ADmad
d9ca148499 Merge branch 'master' into 2.5
Conflicts:
	CONTRIBUTING.md
	lib/Cake/Model/Model.php
	lib/Cake/VERSION.txt
2013-10-30 02:34:09 +05:30
mark_story
a098ff28b8 Update doc block and remove inline assignment. 2013-10-29 12:32:20 -04:00
Mark Story
3dc60af166 Merge pull request #2204 from thatcode/master
Models fetched by Containable find depend on number of fields in intermediate Model
2013-10-25 17:33:32 -07:00
mark_story
7624884240 Use + instead of array_merge.
If you have numeric columns in your database, array_merge() will re-key
the array dropping the original values.

Fixes #2198
2013-10-25 10:23:50 -04:00
Robert Sworder
940a51b5fa Update definition of an empty model. 2013-10-25 15:12:03 +01: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
Marc Würth
3773311cc0 Normalized associated models in unbindModel.
Resolves #1764

 Had to cast $models to an array since ``Hash::normalize()`` doesn't support strings which ``Set::normalize()`` does (but which is deprecated).
 Reused existing tests.
2013-10-24 15:28:31 +02: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
Frank de Graaf
ab89f6ec97 Makes DboSource less string dependent. 2013-10-22 16:43:32 +02:00
Bryan Crowe
bc2fcf421f Remove extra space around the brace in CakeSchema::_arrayDiffAssoc() 2013-10-16 09:52:29 -04:00
Mark Story
ff0b963941 Merge pull request #2142 from bcrowe/hotfix-strictNull
Change is_null() calls to strict checks
2013-10-15 20:00:12 -07:00
Bryan Crowe
5addb2cc9f Change is_null() calls to strict checks in CakeSchema::_arrayDiffAssoc() 2013-10-15 22:53:04 -04:00
Bryan Crowe
39b7023e75 Change is_null() calls to strict checks 2013-10-15 22:32:46 -04:00
Mark Story
ce74153389 Merge pull request #1691 from uzyn/2.5-decimal
Add support for decimal type in Schema.

Fixes #3171
2013-10-14 08:36:15 -07:00
euromark
1cb24ae537 CS fixes using phpcs-fixer auto-correction. 2013-10-12 01:27:00 +02:00
Jose Lorenzo Rodriguez
df549898ad Merge remote-tracking branch 'origin/2.5' into k-halaburda-master 2013-10-12 01:05:02 +02:00
Jose Lorenzo Rodriguez
9673048c30 Merge branch 'master' of github.com:k-halaburda/cakephp into k-halaburda-master 2013-10-12 01:03:20 +02:00
José Lorenzo Rodríguez
8cdbafd312 Merge pull request #1631 from ovidiupruteanu/patch-2
flushMethodCache not working if called before cacheMethod
2013-10-11 15:56:19 -07:00
José Lorenzo Rodríguez
6c2eb6e7c6 Merge pull request #1546 from rchavik/2.3-sqlite-truncate
Sqlite::truncate(): Verify `sqlite_sequence` exists before _execute()
2013-10-11 15:52:49 -07: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
Mark Story
25c4175736 Merge pull request #1713 from ADmad/2.5-modelvalidator-optimize
Optimized whitelist jugglery.
2013-10-08 13:31:53 -07:00
ADmad
f9c1c2aa7f Optimized whitelist jugglery. 2013-10-09 00:17:34 +05:30
euromark
eb852a0247 Strict checks where applicable. 2013-10-08 20:16:55 +02:00
euromark
c621985f69 Fix whitelist to be modifiable from behaviors to work with validate. 2013-10-07 23:45:27 +02:00
Mark Story
49ddf6a5cf Merge pull request #1687 from Schlaefer/model-cache-improvements
performance improvements in Model::_clearCache
2013-10-05 07:50:07 -07:00
U-Zyn Chua
e527506c39 MySQL: Numeric data type now supported under decimal column. #3171 2013-09-28 23:05:53 +08:00
U-Zyn Chua
73cae88a6f SQL Server support of numeric type. #3171
Float & real map to float. Numeric & decimal map to numeric.
2013-09-28 22:48:37 +08: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
U-Zyn Chua
c74c8d49a1 Decimal support for SQLite. #3171 2013-09-28 14:36:55 +08:00
U-Zyn Chua
a1a3e70039 Decimal support for PostgreSQL. #3171 2013-09-28 14:07:00 +08:00
Bryan Crowe
bb65765d70 Updated additional references of Cake to CakePHP 2013-09-27 21:31:35 -04:00
U-Zyn Chua
7fb51ab50f Decimal support for MySQL. #3171 2013-09-28 09:23:46 +08: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
Andy Hobbs
0f7d6a90a1 Ticket 4108
- Added schemaName to DboSource::fields() method cache key to fix bug with changing schema name
2013-09-26 11:56:14 +01:00
ber clausen
39bc8dff97 Wrong signature. 2013-09-25 09:12:49 -03:00
Bryan Crowe
7d7954ce18 Replaced all is_a() calls with instanceof operator 2013-09-24 21:08:06 -04:00
euromark
653aed7701 is_a() to instance of - completes PR 1669 2013-09-24 22:57:51 +02:00
ADmad
1d89ee1c6d Fixed TreeBehavior::recover() when using scope. Fixes #4062. 2013-09-19 00:39:19 +05:30
euromark
382f75dbfc cs corrections, bool to boolean and int to integer. 2013-09-17 14:44:34 +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
ovidiupruteanu
f416a321c7 flushMethodCache not working if called before cacheMethod
When calling flushMethodCache it correctly empties self::$methodCache but if cacheMethod is called afterwards self::$methodCache gets populated with data from the Cache.
2013-09-12 22:02:39 +03:00
Marc Würth
446792987a Replaced two elseifs by if in sqlserver datasource 2013-09-11 23:15:05 +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
ovidiupruteanu
b58940e9b5 Fixed handling null values in Sqlserver->value
The value function quoted a null value as N'' instead of NULL.
As a result is produced queries like [name] IS N'' instead of [name] IS NULL which resulted in an SQL error.
2013-09-09 16:33:54 +03:00
euromark
959988cfa1 Remove last yoda conditions as per coding standards guidelines. 2013-09-06 18:36:57 +02:00
Mark Story
0f528c279a Merge pull request #1614 from okinaka/2.x-disused-code
Postgres::truncate(): Delete disused code.
2013-09-05 18:16:22 -07:00
Mark Story
66394f2201 Merge pull request #1610 from bar/php54-callback-signatures
Update Model/Behaviors callback signature to be PHP5.4+ compliant.

This may require updates to userland behaviours.
2013-09-05 11:11:15 -07:00
mark_story
6a6371b2d4 Fix CROSS JOINs
While seldomly used, CROSS joins should not generate invalid SQL.

Fixes #4050
2013-09-05 12:45:48 -04:00
Ber Clausen
c524645738 Update Model/Behaviors callback signature to be PHP5.4+ compliant. 2013-09-05 11:17:02 -03:00
okinaka
e0f24d0ade Postgres::truncate(): Delete disused code. 2013-09-05 14:11:50 +09: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
euromark
eb71eeeac5 add scope for generateTreeList - resolves ticket 4028 2013-09-01 01:02:26 -07:00
mark_story
f18d354f55 Merge branch 'master' into 2.4 2013-08-28 12:35:07 -04:00
mark_story
c1ae41da51 Correctly generate bigint primary keys in sqlite.
generate bigint primary keys correctly. Autoincrement cannot be set as
it only works with INTEGER columns[1]. I decided to use some string
manipulations as the entire SQL generation bits are a bit janky and I've
already re-written them for 3.0.

[1] https://www.sqlite.org/autoinc.html

Closes #GH-1552
2013-08-27 18:11:04 -04:00
euromark
80d55feda6 also remove app ones 2013-08-25 21:42:03 +02:00
mark_story
53d265cfba Merge branch 'master' into 2.4 2013-08-23 12:56:43 -04:00
mark_story
faa2cbd3c3 Remove session.auto_start configuration.
It now fails in PHP >= 5.5.2 . Also it never did anything in earlier
versions as the session would have already been started if auto_start
was true.

Fixes #4010
2013-08-21 13:18:44 -04:00
Rachman Chavik
9d8bb8c047 Sqlite::truncate(): Verify sqlite_sequence exists before _execute()
`sqlite_sequence` is a dynamic table that's only available when a table in
the database use an auto increment field.  For some cases, eg: databases that
exclusively use uuid for primary keys, this table won't exist and
truncate() call will fail with:

  Error: SQLSTATE[HY000]: General error: 1 no such table: sqlite_sequence
2013-08-21 16:34:21 +07:00
euromark
361980fade remove code, class names and paths from translation strings. 2013-08-21 00:05:53 +02:00
Renan Gonçalves
8ca92a1af0 Breaking trigger_error() to multiple lines to shorten the line length.
As proposed in https://github.com/cakephp/cakephp/pull/1525/files#r5779374
2013-08-20 17:48:56 +02: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
mark_story
3244b9e3d7 Merge branch 'master' into 2.4 2013-08-16 14:47:01 -04:00
euromark
6cf147e8c8 unify null checks - avoid method call in favor of strict check 2013-08-16 20:12:49 +02:00
dmromanov
7989bad5b7 Corrected codestyle 2013-08-16 14:12:27 +04:00
dmromanov
56ef44f495 Excluded method names from several tanslation strings
Removed unnecessary sprintfs
2013-08-16 13:42:28 +04:00
dmromanov
aa7c912c15 Removed concatenations in gettext $msg param. Closes #3986. 2013-08-15 03:15:35 +04:00
mark_story
3bdcf7b440 Use inner join instead of a left join.
In some database servers an INNER join performs better than a LEFT join.

Fixes #3979
2013-08-13 13:40:59 -04:00
k-halaburda
0c1dbded67 Added some test for related model afterFind callback 2013-08-13 10:19:48 +02:00
k-halaburda
bb13af683b Added some test for related model afterFind callback 2013-08-13 10:19:20 +02:00
mark_story
26769edd04 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Utility/CakeTime.php
	lib/Cake/VERSION.txt
2013-08-12 14:39:02 -04:00
mark_story
6ce10b28c9 Update doc blocks. 2013-08-12 14:37:43 -04:00
euromark
f3018cc532 refactor methods to avoid else block on returning early 2013-08-12 19:06:34 +02:00
euromark
b09dc7213a deprecate Controller::flash() and adjust some other deprecation messages. 2013-08-12 12:51:12 +02:00
Jose Lorenzo Rodriguez
9d07fc4330 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Console/ShellDispatcher.php
	lib/Cake/Utility/CakeNumber.php
	lib/Cake/View/Elements/sql_dump.ctp
2013-08-11 23:31:10 +02:00
k-halaburda
74eb32696a Some more space / tabs issues [Travis PHPCS=1 fail] 2013-08-09 11:51:19 +02:00
k-halaburda
2655d16c13 Fixed tabbing in some places 2013-08-09 11:17:12 +02:00
k-halaburda
3855c0690e Fixed tabing formating 2013-08-09 10:26:44 +02:00
k-halaburda
c033df3218 Fixed duplication of Model's afterFind callback in HABTM relation and content of array passed to that callback [ticket 3970] 2013-08-09 09:56:33 +02:00
euromark
fc2d28974b remove undocumented code and uncessary in_array() checks + cleanup 2013-08-08 03:56:58 +02:00
mark_story
e36c537cf6 Switch from LEFT to INNER joins.
INNER joins are often more efficient as they can result in fewer rows
being examined before a result set is generated.

Fixes #3968
2013-08-07 12:50:02 -04: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
mark_story
2d2721d2d9 Update docs for MySQL
MySQL supports a few non-standard options. Document them.
2013-07-19 23:01:16 -04:00
Mike Scarborough
c780ded512 add SSL support to MySQL PDO connections 2013-07-19 22:56:51 -04:00
euromark
7a1a3e593d Always create user agent hash in session 2013-07-18 12:02:42 +02:00
mark_story
e03d3df0fe Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Test/Case/View/HelperTest.php
	lib/Cake/VERSION.txt
2013-07-17 22:40:09 -04:00
Phally
1fe424a62b Moves code out of the try/catch blocks in the connect() methods.
That code wouldn't throw a PDOException, so having it in the
try/catch block is pointless. Moving it out makes it easier to
read.
2013-07-15 12:59:46 +02:00
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
af455b4121 correct return types in doc blocks 2013-07-05 17:19:22 +02:00
euromark
e7f380d2b7 doublespace to single space 2013-07-05 14:36:40 +02:00
euromark
c989624f80 whitespace coding standards 2013-07-05 14:15:18 +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
a90cb29c0f simplify else cases 2013-07-03 01:14:41 +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
Jose Lorenzo Rodriguez
58149f2315 Backporting from 2.4 fix for booleans in mysql when running PHP 5.5 2013-07-02 16:51:29 -04:30
Marc Würth
ff1f80349a Removed superfluous break
In every case of the if clause it will return, so break is not needed.
2013-07-02 21:00:24 +02:00
mark_story
f09693f6e8 Merge branch 'master' into 2.4 2013-06-29 23:26:26 -04:00
Marc Würth
aabeaada0f Fixed @return statement in DboSource::disconnect 2013-06-27 17:38:46 +02:00
Marc Würth
070a6f0ad5 Added a related cookbook link to DataSource.php 2013-06-26 22:07:52 +02:00
Jose Lorenzo Rodriguez
489d1db7d1 More edge case handlignfor native_type in mysql for older versions of
php
2013-06-24 14:15:15 +02:00
Jose Lorenzo Rodriguez
b8bbf0b4a9 Preventing notice in older versions of php 2013-06-24 14:03:50 +02:00
Jose Lorenzo Rodriguez
f6eac9a175 Fixing boolean type introspection for Mysql in PHP 5.5 2013-06-24 13:42:29 +02:00
mark_story
dcf7df39d2 Merge branch 'master' into 2.4 2013-06-21 17:47:37 -04:00
euromark
1b1943954b CakeSession improvements 2013-06-18 23:49:42 +02:00
ADmad
12da3b1f27 Merge branch 'master' into 2.4 2013-06-16 13:07:44 +05:30
Mark Story
b2a40c787d Merge pull request #1327 from pafuinlu/patch-2
Added a clear() function to Model.php (2.4 branch)
2013-06-14 06:18:37 -07:00
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
mark_story
cd3c54bb9d Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/VERSION.txt
2013-06-10 22:12:10 -04:00
euromark
42777b7809 incorrect tab to space - whitespace coding standards 2013-06-09 21:01:01 +02:00
ADmad
636cc8c103 Merge branch 'master' into 2.4 2013-06-09 18:08:32 +05:30
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
mark_story
cbf3228c34 Fix inconsistent name/alias usage.
TranslateBehavior should always use name instead of alias when
creating/updating/saving new translate records. It already uses name
when finding translations and the mismatch was causing translations to
not be found when saved from an aliased model.

Thanks to Joost de Keijzer for providing the initial patch.

Fixes #3865
2013-06-02 13:50:23 -04: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
b111750494 Merge pull request #1308 from Jippi/hotfix/sql-bug-with-not-in-with-one-key
Hotfix/sql bug with NOT in with one key
2013-05-28 10:21:21 -07:00
Christian Winther
9e6120c86a This fixes an issue where attempting to use "!=" in a condition with an array with only a single element generates invalid SQL.
Example:
$condition['Model.id !='] = array(1, 2); //Generates Model.id NOT IN (1, 2) as expected
$condition['Model.id !='] = array(1); //Generates Model.id != = (1) which is invalid SQL

Patch will cause the above to generate Model.id != (1);

This an implimentation of @markstory's suggestion on PR 1232
2013-05-28 11:54:31 +00:00
ADmad
36c592e72e Merge branch 'master' into 2.4 2013-05-26 11:23:53 +05:30
mark_story
9ee610757e Throw exceptions when invalid permission keys are used.
Silently 'failing' to save permissions is bad, throw exceptions instead.

Fixes #3851
2013-05-24 21:47:22 -04:00
mark_story
408aac4798 Update return types. 2013-05-21 15:45:22 -04: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
euromark
8aa0f5a8e9 adjust dbo source for sqlLogs variable 2013-05-06 14:32:47 +02:00
ADmad
a10275fb8b Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
2013-05-05 14:36:46 +05:30
ADmad
db26e24cb7 Remove error setting when reading/deleting non-existent key.
Fixes #3813
2013-05-04 03:16:33 +05:30
mark_story
3d682ba5e4 Update limit() in SQLServer to handle large page numbers as well. 2013-05-02 23:29:10 -04:00
mark_story
d4036310e4 Update limit() for Postgres
It should work like the parent class.
2013-05-02 23:27:26 -04:00
mark_story
00569ea405 Update limit() for Sqlite.
It should behave as the parent class does.
2013-05-02 23:25:13 -04:00
mark_story
7b0af659a9 Stop calling limit() twice on the same data.
DboSource::limit() now follows its documented input types, passing an
already formatted LIMIT string will result in LIMIT 0. Remove useless
array merging as well.
2013-05-02 23:12:38 -04:00
mark_story
2096d3f632 Clamp limit values to be unsigned integers.
This solves large page numbers potentially turning into scientific
notation when being formatted into queries. It also further safeguards
against SQL manipulation.

Refs #GH-1263
2013-05-02 22:36:50 -04:00
ADmad
19f8274a95 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/VERSION.txt
2013-04-25 03:06:04 +05:30
Ceeram
ef90850801 Removing extra whitespace, phpcs fix 2013-04-23 12:54:48 +02:00
Simon Males
77feac9ef6 Second parameter of ClassRegistry::init() is a boolean, not a string 2013-04-22 14:06:30 +08:00
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
ADmad
06a5c509c0 Merge branch 'master' into 2.4 2013-04-21 19:15:55 +05:30
mark_story
0f3d28c6ea Fix condition parsing in mysql specific cases.
When using collation + array values the incorrect operator would be
used. IN should be used over =.

Fixes #3772
2013-04-18 21:52:22 -04:00
ADmad
79ad8ab95a Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Utility/File.php
2013-04-14 00:05:18 +05:30
mark_story
b210849b95 Expand doc blocks for Model::query()
There were some undocumented options that had test cases.

Refs #3748
2013-04-10 21:43:25 -04:00
mark_story
5c83bc177d Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Model/Model.php
	lib/Cake/VERSION.txt
2013-04-09 22:09:56 -04:00
ADmad
819d9e2cbc docblock tweaks for apigen 2013-04-08 00:26:59 +05:30
mark_story
853e19e70e Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Model/Model.php
2013-04-07 14:35:23 -04:00
ADmad
20047c5060 Tweak docblock for api generator 2013-04-07 23:13:03 +05:30
ADmad
56df02f720 Improved docblocks 2013-04-07 18:53:32 +05:30
Rémi Dewitte
c70a3868a9 schema update CREATEs non-existing tables instead of ALTER 2013-04-03 17:37:09 +02:00
ADmad
d809b1480e Fix CS errors 2013-04-01 02:16:52 +05:30
mark_story
041c2d289f Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Console/Shell.php
2013-03-26 20:31:54 -04:00
Andy Dawson
e92e3df2fb Even less queries 2013-03-25 09:46:02 +01:00
Andy Dawson
8ea0212265 make tree recovery much, much simpler 2013-03-24 22:03:20 +00:00
mark_story
729ef8fe58 Fix default null not being reflected by SqlServer
Apply patch from 'Josh Rehm' to fix null default values from being
stomped on when reflecting table schema.

Fixes #3615
2013-03-19 21:02:27 -04:00
mark_story
81dc4c1e85 Merge branch 'master' into 2.4 2013-03-13 20:30:25 -04:00
Ceeram
8374eb92cc fix failing tests. test and mocked sources would cause exceptions 2013-03-13 22:31:23 +01:00
Ceeram
dde0912d1e Throw exceptions only when datasource has wrong package, not check for instance of Datasource 2013-03-13 17:56:51 +01:00
mark_story
3d4ebc038c Throw exceptions when non Datasource classes are used as Datasources.
Using models as datasources can cause segmentation faults. Guard against
that by checking types and raising exceptions early.

Fixes #3694
2013-03-12 21:59:45 -04:00
mark_story
8209097bc3 Merge branch 'master' into 2.4 2013-03-09 12:40:59 -05:00
Rémi Dewitte
ab510d1700 Add settings array to connection parameters that executes SET statements once connected 2013-03-07 23:45:42 +01:00
Adam Taylor
433dd09ec4 Fix typos 2013-03-05 00:05:14 -07:00
mark_story
4b13e0a5f2 Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/VERSION.txt
2013-03-04 21:55:29 -05:00
Rémi Dewitte
9ecbdf4971 better with strict comparison 2013-03-01 15:51:15 +01:00
Rémi Dewitte
e2e5dfb91e Keep default=false for boolean columns 2013-03-01 15:43:14 +01:00
mark_story
1d3095ece5 Fix formatting and expand find() docs. 2013-02-26 22:00:55 -05:00
mark_story
33bd7a571a Restore whitelist when save fails.
Fixes whitelist not being restored when save fails due to no data.

Fixes #3646
2013-02-25 20:57:56 -05:00
mark_story
d1c88ebf8a Merge branch 'master' into 2.4
Conflicts:
	lib/Cake/Log/Engine/FileLog.php
	lib/Cake/Utility/Validation.php
	lib/Cake/View/Helper/HtmlHelper.php
2013-02-24 20:24:26 -05:00
ADmad
b32e855a3d Fixing behavior prioritizing 2013-02-24 22:52:31 +05:30
nojimage
84725993e5 Postgres datasource support regular expression operators. 2013-02-22 10:14:06 +09:00
José Lorenzo Rodríguez
ef592363d6 Merge pull request #1123 from dogmatic69/model-cache
Breaking out the find so that it can be easily overloaded for caching
2013-02-16 06:05:11 -08:00
Mark
3b02013f7d Merge pull request #1127 from dereuromark/master-strict-comparison
Strict comparison for strings where applicable
2013-02-14 01:10:48 -08:00
nojimage
fbb1a812dd Create rename field statements in postgres
Refs #3622
2013-02-13 22:24:21 -05:00
mark_story
0d9ef854ff Fix FULLTEXT column generation
Fixes #3618
2013-02-12 09:00:57 -05:00
euromark
111366d5c8 == to === and != to !== where applicable 2013-02-12 03:38:08 +01:00
dogmatic69
e9a385e790 Adding the _findAll method
Now there are no special checks for find('all') and the find can be overloaded like you would
with any other find(*) methods.
2013-02-10 21:06:29 +00:00
dogmatic69
83a11b7189 adjusting the changes and adding some docs 2013-02-10 11:13:22 +00:00
dogmatic69
00abe27ef8 Breaking out the find so that it can be easily overloaded for caching
Before this commit you have to do some hacks to cache model finds easily. When using
custom find methods like `find('foo')` => `_findFoo(...)` it is common for the
method to adjust the query params.

Trying to cache a query using a hash of the query params :

	function find($type, $query) {
		$query = $this->_beforeFind($query);
		$cacheKey = $type . '_' . md5(selialize($query));

		$cache = Cache::read($cachKey, 'my_cache');
		if ($cacheKey !== false) {
			return $cache;
		}

		$results = $this->_afterFind($type, $query);
		Cache::write($cacheKey, $results, 'my_cache');

		return $results;
	}

Before this commit you either have to completely overload find and rewrite it in the AppModel or call
the before to get the modified `$query` and let cake run the before again.
2013-02-09 16:20:46 +00:00
ADmad
13029cc2bc Merge branch 'master' into 2.4 2013-02-09 02:20:16 +05:30
Graham Weldon
26a08c6780 Updated copyright 2013-02-08 21:28:17 +09:00
Graham Weldon
66d856d883 Added extra line for referencing license file for copyright 2013-02-08 21:22:51 +09:00
Graham Weldon
7b860debe4 This commit is dedicated to Mark Story, who has put in much dedicated time and effort into CakePHP over the years.
I just wanted to ruin his evening, because this change needs to be merged into CakePHP 3.0.
2013-02-08 20:59:49 +09:00
mark_story
1ceb17589a Merge branch 'master' into 2.4 2013-02-06 21:05:03 -05:00
Marc Würth
02e2fbe800 Fixed wrong statement in Sqlserver class header
http://www.php.net/manual/en/ref.pdo-sqlsrv.php

--> PDO_SQLSRV is a driver that implements the PHP Data Objects (PDO) interface to enable access from PHP to MS SQL Server (starting with SQL Server 2005) and SQL Azure databases.
2013-02-05 18:32:40 +01:00
Marc Würth
fa118a73a9 Fix for CakeShell schema generate for Sqlsrv
Do not generate invalid schema.php when using SQLServer

Refs #3559
2013-02-04 21:19:56 -05:00
euromark
05546aff32 coding standards 2013-02-04 09:26:50 +01:00
Perry
af71d5528f apply code convention 2013-02-01 09:30:45 +08:00
ADmad
fb7fbcf01b Added option to disable counter caches updating.
Closes #3109
2013-01-31 18:14:39 +05:30
Perry
5ac5e784de fix a DboDataSource buildJoinStatement bug that table prefix is appended to subquery 2013-01-31 17:01:59 +08:00
mark_story
4af6039107 Merge branch 'master' into 2.3
Conflicts:
	lib/Cake/Console/Command/Task/ModelTask.php
	lib/Cake/Model/Model.php
2013-01-26 21:16:26 -05:00
Ceeram
16be9d4990 remove unused local vars 2013-01-23 17:22:06 +01:00
mark_story
efadf3dcd3 Make sure sessions are started before destroying them.
Fixes #3551
2013-01-21 20:46:41 -05:00
mark_story
7790bcacff Allow afterFind() to fully remove an associated record.
By returnning array() or unsetting the 0'th result an afterFind
callback should be able to fully remove data from the results.

Fixes #3541
2013-01-17 20:35:37 -05:00
mark_story
18e282f3aa Fix space between function + parenthesis. 2013-01-17 19:36:46 -05:00
Renan Gonçalves
23d4807933 Fixing expected value from find when it results in failure.
When a behavior callback (eg: beforeFind) stops the event, find will return null. False is really never returned from find().
2013-01-17 13:00:56 +01:00
euromark
19cfe40fd1 fix return type in docblock 2013-01-12 16:26:44 +01:00
euromark
11a88042bd fix doc block endings 2013-01-11 15:06:54 +01:00