Commit graph

1483 commits

Author SHA1 Message Date
Sebastien Barre
3849df0f2f fix duplicate primary keys for tables without models 2017-03-05 21:47:00 -05:00
Sebastien Barre
7c0bcb16c8 add missing MySQL data type link 2017-03-05 12:28:41 -05:00
Sebastien Barre
38101995b4 introduce new tinyint, smallint types for smaller storage requirements 2017-03-05 12:25:14 -05:00
Sebastien Barre
d01f3e8aed allow data sources to provide smaller integers based on storage requirements 2017-03-04 00:08:27 -05:00
chinpei215
c5ad005475 Add return description 2017-03-02 20:34:28 +09:00
chinpei215
923b73a7ba Add support for having/lock options 2017-02-03 17:51:22 +09:00
Cory Thompson
55324c0b2a Allow SQL json selects without defining table name 2017-01-24 20:54:07 +11:00
Cory Thompson
990d0a962f Allow database JSON operations in conditions 2017-01-24 19:33:12 +11:00
Cory Thompson
82a64a3729 Merge remote-tracking branch 'doublemap/exclude-column-trailing-hyphen' into ticket-8872 2017-01-24 19:25:24 +11:00
mark_story
1a8f2202c0 Merge branch '2.x' into 2.next 2017-01-03 11:01:04 -05:00
mark_story
e01f5989af Use array conditions for joins.
Use array style conditions instead of using lower-level DboSource API
methods to create safe SQL.

Refs #9927
2016-12-28 23:18:30 -05:00
mark_story
837741db66 Merge branch '2.x' into 2.next 2016-12-13 22:48:44 -05:00
chinpei215
21502db34a Fix TreeBehavior does access property/method via model 2016-12-13 07:15:48 +09:00
mark_story
e057b5572c Fix PHPCS. 2016-11-21 20:51:12 -05:00
mark_story
71b7d6211b Fix AclNode constructor.
It should forward the settings from ClassRegistry::init() so that
aliases can be customized as needed.

Refs #9766
2016-11-19 22:30:18 -04:00
Mischa ter Smitten
e71afa225e Merge remote-tracking branch 'upstream/2.x' into make-it-possible-to-configure-cachemethodhashalgo-in-dbosource 2016-11-14 16:26:48 +01:00
Mischa ter Smitten
1952d2ee17 Add tests for cacheMethodFilter 2016-11-14 11:44:35 +01:00
Mischa ter Smitten
71535d2d2c Change cacheMethodFilters to be a method 2016-11-14 11:15:08 +01:00
Mischa ter Smitten
e186ffc6d3 Change cacheMethodHashAlgo to be a method 2016-11-14 09:42:19 +01:00
Mischa ter Smitten
15ccf057f4 Make it possible to configure cacheMethodHashAlgo in DboSource 2016-11-12 00:18:13 +01:00
Mischa ter Smitten
58cc9b4596 Make it possible to filter values per method in DboSource::cacheMethod 2016-11-11 23:37:23 +01:00
mark_story
135a24e0f1 Merge branch '2.x' into 2.next 2016-10-28 00:29:46 -04:00
mark_story
816801902e Allow '' to be a valid key for Hash, and Session
By removing a bunch of empty() guards we can make '' behave like all the
other key names. This does change the existing behavior/tests around ''
key, but I think that is ok given the need to manipulate ''.

Refs #9632
2016-10-21 10:54:39 -04:00
mark_story
ecd270d04b Tweak/Add doc blocks. 2016-10-09 11:05:35 -04:00
David Maicher
a932bce3de [Bugfix] use Model::$cacheQueries as default for ->query(...) 2016-10-09 13:43:27 +02:00
José Lorenzo Rodríguez
9425234b87 Merge pull request #9550 from cakephp/issue-9526
Fix enum column length detection.
2016-10-06 09:29:25 +02:00
mark_story
9c3b17cbc7 Fix failing test in postgres. 2016-10-05 22:28:51 -04:00
mark_story
689d516a99 Fix typo. 2016-10-04 21:38:26 -04:00
mark_story
3a185f9713 Remove incorrrect postgres implementation.
It was wrong, and no longer really needs to exist as the parent method
covers all the scenarios that were previously required other than the
uuid one.
2016-10-02 22:59:13 -04:00
mark_story
3587ac9976 Fix PHPCS error. 2016-10-02 19:06:10 -04:00
Andrej Griniuk
2d6e85ed14 validate table name before generating schema file 2016-10-03 00:23:05 +08:00
mark_story
e41ccdb701 Fix enum column length detection.
Use simpler code to calculate the length of fields. Include more tests
for DboSource as there weren't any before.

Refs #9526
2016-09-30 22:25:25 -04:00
Rozehnal, Pavel
34fa24f225
Avoiding extract in CakeSchema class
due bad readability and avoiding parsing error in IDEs - no functional changes
2016-09-19 14:10:02 +02:00
mark_story
ad5130cd31 Merge branch '2.next' into 2.x 2016-09-18 22:22:56 -04:00
mark_story
835c709dfd Add code fencing on example. 2016-09-16 19:17:08 -04:00
Marc Würth
1b101f73a6 Minor DocBlock improvement 2016-09-16 13:02:55 +02:00
Val Bancer
427d928d10 minor code style improvements 2016-09-05 21:53:10 +02:00
Val Bancer
98cd278c02 improved performance of insertMulti() in Mysql 2016-09-05 21:28:07 +02:00
mark_story
61b3fbd605 Merge branch '2.x' into 2.next 2016-08-09 22:12:26 -04:00
Mark van Driel
4dc8e54131 Fixed typo 2016-07-27 20:27:15 +02:00
Mark van Driel
5caac5f340 Prevent unnecessary joins / complex conditions in delete 2016-07-27 16:31:57 +02:00
Andrej Griniuk
e7f3365d8b fix on php < 5.5 2016-07-26 23:57:14 +03:00
Andrej Griniuk
147693618c refs #9174 fix CakeSchema compare when changing field length to the default one 2016-07-26 23:39:09 +03:00
Mark van Driel
c01525f2cc Make check more strict to respect existing queries 2016-07-26 11:25:27 +02:00
Mark van Driel
d6e45131ad Prevent unnecessary joins / complex conditions in delete 2016-07-25 17:15:18 +02:00
Philippe Saint-Just
be7cecbb00 Removed whitespace 2016-07-10 14:02:55 +01:00
Philippe Saint-Just
7edcdb0799 Handle plugin association consistently 2016-07-09 16:08:16 +01:00
mark_story
432eb9c432 Merge branch '2.x' into 2.next 2016-06-27 21:47:47 -04:00
mark_story
92a50d05dc Reset query timing metrics for begin/commit/insert multi calls.
Apply patch from @Mensler to reset the query metrics for transaction
operations, and for each iteration of an insertMulti call. This helps
provide more accurate query times.

Refs #9014
2016-06-22 22:20:00 -04:00
Eric Jiang
9f9ae8a9fd Ignore final hyphen in column name when requoting
An expression like "Foo"."bar"->'prop' should not be re-quoted as
"Foo"."bar-">'prop'. Bare columns cannot include hyphens in most DBs
anyways.
2016-05-19 01:56:20 -07:00
Markus Bauer
2227e01990 Fixing Sqlite's handling of datetime/timestamp columns with current_timestamp default set 2016-05-19 00:21:43 +02:00
mark_story
12c6fd4e22 Merge branch '2.x' into 2.next 2016-05-02 21:58:41 -04:00
chinpei215
1826b4cb08 Add DboSource::flushQueryCache() 2016-04-19 00:01:06 +09:00
mscherer
dda9e83ab6 Refactor Object to CakeObject for future PHP7 comp. 2016-04-08 14:33:26 +02:00
Thomas Smith
3e86de5bcd Replaced nested loop in merging hasMany children with one pass each through children and parents 2016-03-16 09:37:15 -07:00
mark_story
fef3090717 Fix incorrectly inheriting permissions.
When child inherits from a deny parent the '*' permission should reflect
permissions on all nodes not just the leaf node. Previously once a node
with all permissions set to inherit was found, the check would pass.
Instead it should cascade to the parent nodes and look for explicit
allow/deny.

Refs #8450
2016-03-11 23:18:50 -05:00
mark_story
1709f54e38 Update documentation for Model::_readDataSource()
Update sample code to generate unique keys based on association
conditions as well. Because association conditions are not part of the
'query' they need to be handled separately.

Refs #8346
2016-02-26 12:39:29 -05:00
Mark Story
ff6cdd4b73 Merge pull request #8279 from cakephp/issue-8114
Fix inherited permissions when checking the '*' permission.
2016-02-22 14:48:58 -05:00
mark_story
ee2d222b85 Correct API docs for find().
Fixes #8308
2016-02-21 22:42:24 -05:00
mark_story
4389c79442 Update tests.
The old tests were relying on the fixed inherit bug. Instead check
a specific permission which will result in a deny.

Refs #8114
2016-02-18 21:24:52 -05:00
mark_story
7a5907057a Ensure keys are strings before accessing them.
Some userland datasources (namely an oracle driver) manage to get arrays
into $stack.

Refs #8281
2016-02-18 21:03:57 -05:00
mark_story
b2509ea13d Fix inherited permissions when checking the '*' permission.
When checking inherited permissions for '*' also copy inherited
permissions onto the inherited list. By copying the inherited values, we
get the union of explit allow and inherited permissions, which if all
things go well will match the permission key list.

Refs #8114
2016-02-16 22:30:19 -05:00
Mark Story
68082fad02 Merge pull request #8207 from CakeDC/feature/uuid
Add support for Postgres native uuid datatype
2016-02-16 21:53:08 -05:00
Seth Tanner
c05835d85d refs #8027 combine if statements 2016-02-11 01:49:34 +00:00
Mark Scherer
f1bea77d74 Fix bool check and also some doc blocks. 2016-02-09 01:18:43 +01:00
mark_story
c0d897b45c Merge branch '2.x' into 2.8 2016-02-06 20:55:08 -05:00
mark_story
0309c483fb Don't make variables we never use. 2016-02-06 20:34:19 -05:00
Mark Story
41a12e9aa2 Merge pull request #8067 from cakephp/issue-7906
Make the session cacheLimiter a configuration option.
2016-02-06 20:30:48 -05:00
mark_story
d9992bcaca Use safer methods to read session configuration.
Avoid potential undefined index warnings by using read() to safely fetch
data.

Refs #8101
2016-01-30 16:21:33 -05:00
mark_story
3b5a71df37 Merge branch '2.7' into 2.8 2016-01-28 21:51:59 -05:00
Mark Story
aa449b194d Merge pull request #8125 from CakeDC/issue/7978
Add support for NOT IN in Model::find() conditions.

Refs #7978 fixing regex to take in account IN operator
2016-01-28 21:48:04 -05:00
Edgaras Janušauskas
6e54a7391c Use more specific datatypes in PHPDoc 2016-01-28 23:10:51 +02:00
Edgaras Janušauskas
fde1d08b43 Fix PHPDoc @return by replacing $this to self 2016-01-28 23:10:42 +02:00
Yevgeny Tomenko
70c4e40532 Fix value check and formatting. 2016-01-28 23:36:07 +03:00
Pedro Fernandes Steimbruch
eaeb7cea9e Refs #7978 fixing regex to take in account IN operator 2016-01-28 17:34:08 -02:00
Yevgeny Tomenko
06853a137a Merge remote-tracking branch 'remotes/origin/2.8' into feature/uuid 2016-01-28 22:08:10 +03:00
Yevgeny Tomenko
296f698db3 Added test cases covering native uuid field usage for Postgres class 2016-01-28 21:13:33 +03:00
Larry E. Masters
7c37cf5b5f Using _cookieName() instead session_name() 2016-01-19 16:29:56 -06:00
mark_story
57f620fc22 Make the session cacheLimiter a configuration option.
Instead of hardcoding to must-revalidate, developers can use a more
suitable option if they do not have to support IE8.

Refs #7096
2016-01-18 22:18:38 -05:00
Seth Tanner
47bf98cae4 refs # 7929 refactor uuid support to not break Backward Compatibility 2016-01-15 11:43:01 -08:00
Seth Tanner
66f3a7e487 refs issue #7929 add support for Postgres native uuid datatype 2016-01-14 09:37:06 -08:00
Larry E. Masters
0aa8847762 Merge pull request #7840 from cakephp/2.8-PHP7
2.8 PHP7 compatibility
2015-12-29 00:27:33 -05:00
Larry E. Masters
e7a313edee getting sloppy as I get older, fixing code sniffer errors 2015-12-29 00:06:44 -05:00
Larry E. Masters
6ee621011b Using function_exists instead of using constant 2015-12-28 23:50:35 -05:00
Larry E. Masters
bc005cd014 Fixing Undefined index: Session 2015-12-28 23:32:18 -05:00
Larry E. Masters
a1e140cbe0 Removing check for set key 2015-12-28 23:26:58 -05:00
Larry E. Masters
a966e46545 Allowing returning numeric 0 from read 2015-12-28 23:26:06 -05:00
Larry E. Masters
a02fb9e771 Fixing code sniffer errors 2015-12-28 18:40:14 -05:00
Larry E. Masters
a59ea13712 Fixes SessionComponentTest::testSessionValid. Refactored _hasSession and other erros on php 7
init would always set CakeSession::$_userAgent.
2015-12-28 17:26:35 -05:00
Larry E. Masters
c2449c9d16 Fixing Code Sniffer errors 2015-12-28 17:15:23 -05:00
Larry E. Masters
33f2f46868 Refactoring and emoving one isset check 2015-12-28 11:52:19 -05:00
Larry E. Masters
5c3bc44ef5 Initial fixes for failing session tests 2015-12-28 11:41:23 -05:00
Larry E. Masters
9abb4e19f2 Removing forced return true 2015-12-22 16:22:34 -05:00
Larry E. Masters
dd11c63069 Changing return types
read now returns empty string instead of false when read method returns an empty value.
write, destroy and gc will return boolean type
2015-12-22 16:19:51 -05:00
Larry E. Masters
577e1b089f Revert "Forcing bool return"
This reverts commit fac95baee7.
2015-12-14 19:31:08 -06:00
Larry E. Masters
dd211e9158 Revert "Changing where bool is returned"
This reverts commit 8f52cefdcc.
2015-12-14 19:30:42 -06:00
Larry E. Masters
464a266fc7 Revert "Using better way to check for active session"
This reverts commit 439a33c708.
2015-12-14 19:30:24 -06:00
Larry E. Masters
1a3598c3f4 Revert "session_status() not available until 5.4"
This reverts commit da9b6453ce.
2015-12-14 19:29:08 -06:00
Larry E. Masters
da9b6453ce session_status() not available until 5.4
Adding check for php version
2015-12-14 10:56:55 -06:00
Larry E. Masters
439a33c708 Using better way to check for active session 2015-12-14 10:42:46 -06:00
Larry E. Masters
8f52cefdcc Changing where bool is returned 2015-12-14 09:17:29 -06:00
Larry E. Masters
fac95baee7 Forcing bool return 2015-12-13 20:05:54 -06:00
chinpei215
726699ee7a Magic call with custom finders
Now we can use findListBy, etc - closes #7674
2015-11-11 22:43:19 +09:00
mark_story
8c404ad6a7 Merge branch '2.7' into 2.8 2015-10-17 21:00:26 -04:00
mark_story
e2a1094e69 Define variables before they are used.
Refs #7563
2015-10-16 23:07:25 -04:00
mark_story
707915e693 Merge branch '2.7' into 2.8 2015-10-15 22:10:56 -04:00
Marc Würth
ed410dd12c Do not mix void with other return types
Inspired by #7527
2015-10-10 15:49:00 +02:00
Marc Würth
de8aed534f Add false as return value of field()
+ improve DocBlocks
2015-10-08 16:31:01 +02:00
mark_story
ae83e197dc Merge branch '2.8' of github.com:cakephp/cakephp into 2.8 2015-09-27 11:13:12 -04:00
Mark Story
12f5aee5a2 Merge pull request #7447 from ravage84/2.7-lib-improvements
Various improvements to the CakePHP lib files
2015-09-25 12:14:00 -04:00
Marc Würth
e690662f0e Various improvments to the CakePH Plib files
Mostly CS, doc blocks and explicit returning nulls.
2015-09-25 17:11:20 +02:00
Mark Scherer
81cbb52f74 Only array-wrap 'order' if it's not already an array. 2015-09-22 13:04:28 +02:00
Mark Story
9208a0857e Merge pull request #7428 from burriko/fix-dbo-connection-issues
Fix use of $_connection in DboSource in 2.x
2015-09-21 21:38:20 -04:00
Graeme Tait
dc856b8508 Switch out is_null() 2015-09-21 17:00:20 +01:00
Graeme Tait
1b33efaad3 Check $_connection is not null before trying to use it
Stops a fatal error if calling isConnected() after disconnect().
2015-09-21 14:08:07 +01:00
Graeme Tait
8fae10a971 Set DboSource::$_connection to null on disconnect 2015-09-21 14:05:56 +01:00
Mark Scherer
97b6f8674c Fix CS 2015-09-21 13:45:18 +02:00
mark
d8a55ad065 Allow CURRENT_TIMESTAMP for datetime columns - MySQL5.6+. 2015-09-16 14:16:58 +02:00
thomasv
1dbb6dd0e4 Update DatabaseSession.php
To prevent error: "Integrity constraint violation: 1052 Column 'id' in where clause is ambiguous" when using a custom Session object in relationship with another object (belongsTo <-| hasMany)
2015-09-10 00:25:39 +02:00
mark_story
60d7bbaa10 Always update updated/modified columns when a fieldList is used.
When a fieldList is used, and updated is not in the fieldList, the
column should continue to be updated even if the column has a value from
the user. Because the field is not in the fieldList, we must assume that
the intent is for the field to update automatically, as it would have if
the updated column was not present in the save data.

Refs #7076
2015-09-05 22:01:33 -04:00
James Tancock
fdb41e01bb Alter Model::exists() to return false with no table 2015-08-18 13:07:30 +01:00
James Tancock
90a77f6ce5 Alter model exists to consider useTable 2015-08-16 19:06:12 +01:00
paolo
a7b5f8c3af DboSource now check the actual status of connection by executing a dumb query on DB
This change makes it possible for developer to build reconnection logic
on MySQL connections which frequently time out in long running CLI
processes.

Cherry picked onto 2.7 from #7190.
2015-08-07 21:59:28 -04:00
Mark Story
de4b44a37b Merge pull request #7077 from dereuromark/2.7-static
Replacing self with static due to PHP5.3+. Following #7040.
2015-07-23 22:27:37 -04:00
mark_story
c6e5026767 Fix issues saveMany & saveAssociated with boolean values.
For non-atomic, save operations that include models with boolean fields.
The first false value would cause the save to abort. This regression was
introduced in #6947. Instead of checking the data from save() we should
be boolean casting save() to capture the success/failure.

Refs #7069
2015-07-22 00:41:10 -04:00
Mark Scherer
52e79987a2 Replacing self with static due to PHP5.3+. Following #7040. 2015-07-21 10:22:53 +02:00
mark_story
47378427e3 Merge branch '2.6' into 2.7 2015-07-11 21:25:26 -04:00
mark_story
65c1745349 Add missing parameter to rawQuery()
Previously bound parameters were put in the incorrect position.

Refs #6992
2015-07-10 12:56:49 -04:00
mark_story
59a18e7709 Merge branch '2.6' into 2.7 2015-07-07 22:05:56 -04:00
hiromi2424
deb62c8887 #6935 Fix deep saving for hasMany could not handle validation errors correctly 2015-07-04 06:10:58 +00:00
Lawrence Barsanti
0b28c2e839 Added negative lookahead
It is possible to have multiple occurrences of 'as' in a field name.
Use the last occurrence of 'as' when extracting field name.

Tested with following examples:
"WeldCheck"."weld_id"
count(*) as WeldCheck__num_measurements
count(case decision when 2 then 1 else null end) as
WeldCheck__num_failures
avg(cast (WeldMeasurement.surface_indentation as bigint)) as
WeldCheck__avg_indentation
avg(cast (WeldMeasurement.circle_diameter as bigint)) as
WeldCheck__avg_diameter
2015-06-25 22:21:38 -04:00
mark_story
ae2ea1ea6c Merge branch '2.6' into 2.7 2015-06-25 21:50:47 -04:00
mark_story
2f616a9e0c Fix greedy regex operators in Postgres driver.
`*` is greedy in regex, and needs to be escaped so that SQL operators
don't cause invalid SQL conditions to be created.

Refs #6877
2015-06-24 23:39:26 -04:00
Mark Scherer
0524eb95ae Documentation update 2015-06-01 16:14:15 +02:00
Mark Scherer
4ad001b9ca Use options array. 2015-06-01 16:12:45 +02:00
Mark Scherer
670d93b6f6 Extract formatTreeList() from generateTreeList(). 2015-06-01 12:36:20 +02:00
mark_story
d7d8b90986 Merge branch '2.6' into 2.7 2015-05-28 19:34:59 -04:00
mark_story
52a0d642ec Fix incorrectly quoted table aliases in virtual fields.
DboSource::_quoteFields() is already a bit of a mess, and while I'm not
happy about having to add more regex replacement, it seems to be the
only reasonable solution given that the code is already 'parsing' SQL
to apply identifier quoting.

Fixes #6602
2015-05-20 22:40:47 -04:00
Mark Scherer
4f3602ad5f Adjust bake, docblocks and tests for notBlank. 2015-05-17 22:27:16 +02:00
mark_story
096a2ebb72 Merge branch '2.6' into 2.7
Conflicts:
	lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
	lib/Cake/VERSION.txt
2015-04-20 15:42:54 -04:00
mark_story
b2958dad79 Re-add call to parent destructor.
In 762ebd4 a destructor was added to DboSource, this accidentally
removed the rollback on destruct that Datasource provides. Restoring
this via a parent call allows pending transactions to be rolled back at
the end of a request.

Fixes #6251
2015-04-01 20:37:06 -04:00
mark_story
446dd408bb Renew the session even the session id is '0'.
This fixes AuthComponent not being able to log a user in when they
inadvertently change their session id to 0.

Refs #6053
2015-03-29 21:42:43 -04:00
mark_story
3151c53255 Merge branch '2.6' into 2.7 2015-03-23 22:50:09 -04:00
mark_story
827465fa30 Merge branch 'postgres_altercolum_error' into master
Merge changes from #5512 into master. This fixes changing columns in
postgres to integer from string types.
2015-03-14 22:23:43 -04:00
mark_story
c32e5559bb Add test to ensure column was converted to integer.
Refs #5512
2015-03-14 22:23:17 -04:00
mark_story
8cadb553d7 Merge branch 'master' into 2.7 2015-03-14 22:08:53 -04:00
Marc Würth
4f9d764fc2 Fixed link to cookbook 2015-03-11 11:27:30 +01:00
mark_story
0b916cedbb Merge branch 'master' into 2.7 2015-03-09 21:55:20 -04:00
mark_story
a9519d39f7 Fix whitelist being empty during afterSave.
whitelist should only be reset after afterSave event.

Refs #6028
2015-03-08 13:51:46 -04:00
ADmad
7173f21dc8 Type hint model param 2015-03-04 21:15:24 +05:30