# |
May 2nd 2019, 10:47 |
hippo |
``` ->select([ 'date' => $queryDate ]) ``` |
# |
May 2nd 2019, 10:45 |
neon1024 |
I tend to use type for Telephone, Postcode, and EncryptedString :slightly_smiling_face: |
# |
May 2nd 2019, 10:45 |
neon1024 |
You can create your own Type classes |
# |
May 2nd 2019, 10:43 |
hippo |
to avoid errors like > Notice (8): Undefined index: "date" [CORE/src/Database/FieldTypeConverter.php, line 81] |
# |
May 2nd 2019, 10:42 |
hippo |
Is there a way I can add to the typeMap of a query? |
# |
May 2nd 2019, 10:12 |
hippo |
Going to go with the second one for now :slightly_smiling_face: |
# |
May 2nd 2019, 10:11 |
hippo |
Only that last one worked.. Tried this as well (`->func()->extract('dow', 'Test.timestamp', ['Test.timestamp' => 'literal']);`) |
# |
May 2nd 2019, 10:08 |
hippo |
Would a function like this quote identifiers? (with identifier quoting enabled) ``` ->func()->extract('dow', 'Test.timestamp') ``` Or would this be correct? ``` ->func()->extract('dow', new \Cake\Database\Expression\IdentifierExpression('Test.timestamp')) ``` |
# |
May 2nd 2019, 09:49 |
conehead |
Similar to what I got, but still a bit more clever. Will adjust my code! |
# |
May 2nd 2019, 09:44 |
conehead |
Looks exactly like what I was looking for ;) |
# |
May 2nd 2019, 09:44 |
conehead |
Cheers! I will have a look |
# |
May 2nd 2019, 09:43 |
dereuromark |
Sandbox shows the examples, and Setup plugin has a demo bake template that can auto create everything including forms for it based on the methods. |
# |
May 2nd 2019, 09:42 |
dereuromark |
See either different enum behavior strategies in awesome list, or use what I recommend and call semi-static-enums ( https://www.dereuromark.de/2010/06/24/static-enums-or-semihardcoded-attributes/ ), I use entities for it. |
# |
May 2nd 2019, 09:34 |
conehead |
Hm just wondering....if you have an integer field in a model and each value stands for a specific string. where would you put the logic to transform the integer value to the correct string. Create a helper for that specific model that turns 1 => 'Foo', 2 => 'Bar'? |
# |
May 2nd 2019, 09:15 |
neon1024 |
Could do with a logo update I guess :thinking_face: |
# |
May 2nd 2019, 09:14 |
neon1024 |
https://www.openhub.net/p/cakephp |
# |
May 2nd 2019, 09:14 |
neon1024 |
I was looking at the project openhub page |
# |
May 2nd 2019, 09:01 |
admad |
"COCOMO model" I vaguely remember that term from college days :P |
# |
May 2nd 2019, 08:43 |
conehead |
Haha. I might join one day |
# |
May 2nd 2019, 08:42 |
neon1024 |
Will be an exciting moment when CakePHP breaks 1000 contributors |
# |
May 2nd 2019, 08:41 |
neon1024 |
To build CakePHP |
# |
May 2nd 2019, 08:41 |
neon1024 |
> took an estimated 54 years of effort (COCOMO model) |
# |
May 2nd 2019, 08:05 |
neon1024 |
Morning everyone :wave: |
# |
May 2nd 2019, 06:49 |
conehead |
Still don't really get what you mean. Timestamp is just an integer value. So yes, mysql and cakephp should not care at all |
# |
May 2nd 2019, 06:49 |
COOurb |
aha, it works, thanks |
# |
May 2nd 2019, 06:48 |
COOurb |
does* |
# |
May 2nd 2019, 06:48 |
COOurb |
dow it works with mysql+cakephp stuff? |
# |
May 2nd 2019, 06:47 |
conehead |
dont really get what you want. Why can't you just use php `time()` method? |
# |
May 2nd 2019, 06:40 |
COOurb |
and that sucks |
# |
May 2nd 2019, 06:40 |
COOurb |
I can't iuse behavior without enity |
# |
May 2nd 2019, 06:35 |
COOurb |
how t oset current timestamp in query builder? set(['updated'=>???]) |
# |
May 2nd 2019, 05:39 |
ra7bi |
@dakota @conehead Thanks , at the end i must have two query and combine them to select list |
# |
May 2nd 2019, 05:32 |
slackebot |
``` |
# |
May 2nd 2019, 05:32 |
conehead |
@ra7bi Never tried, but there seems to be a `toList()` method as well. https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#using-finders-to-load-data ``` / Calling all() will execute the query // and return the result set. $results = $query->all(); // Once we have a result set we can get all the rows $data = $results->toList(); // Converting the query to a key-value array will also execute it. $data = $query->toArray(); |
# |
May 2nd 2019, 04:35 |
dakota |
@ra7bi |
# |
May 2nd 2019, 04:35 |
dakota |
The collection class's combine method does just that (that's actually what find('list') uses internally) |
# |
May 2nd 2019, 04:11 |
ra7bi |
i've two table linked associated to each , and each table hasMany data from `x` table , i want to create a list of `x` table belong for both table |
# |
May 2nd 2019, 04:08 |
ra7bi |
i mean the result of find all i need to modify it and then convert it to list |
# |
May 2nd 2019, 04:07 |
ra7bi |
is there a function in cakephp 3.x to convert `find('all') ` results into `find('list')` |
# |
May 1st 2019, 20:25 |
ricksaccous |
interesting |
# |
May 1st 2019, 20:25 |
ricksaccous |
actually you can't bind field aliases |