# |
Mar 26th 2019, 18:17 |
ricksaccous |
@dereuromark sorry, was the cache |
# |
Mar 26th 2019, 18:16 |
ricksaccous |
let me see that could be it |
# |
Mar 26th 2019, 18:16 |
dereuromark |
cache issue? |
# |
Mar 26th 2019, 18:16 |
ricksaccous |
weird, because i just ran the migrations fresh |
# |
Mar 26th 2019, 18:16 |
dereuromark |
sounds like you either didnt run the migrations correctly, or have some other data integrity issue |
# |
Mar 26th 2019, 18:15 |
ricksaccous |
i mean bin/cake queue but you get what i mean |
# |
Mar 26th 2019, 18:15 |
ricksaccous |
@dereuromark i'm getting trouble after trying bin/queue runworker i get General error: 1364 Field 'workerkey' doesn't have a default value in |
# |
Mar 26th 2019, 17:20 |
devito |
the calculated colum is created, however when i try to add where conditions to the query targeting the calculated column i still get the missing column error. im guess the where func is scanning the schema columns and not the items used in the select. |
# |
Mar 26th 2019, 16:13 |
devito |
thanks. let me tinker with this |
# |
Mar 26th 2019, 16:13 |
devito |
mm i see |
# |
Mar 26th 2019, 16:13 |
neon1024 |
You can also use `->enableAutoFields(true)` I think to get all columns from all tables |
# |
Mar 26th 2019, 16:12 |
neon1024 |
As per the comment given in the example, it’s passing a Table instance into the select() to get all the available fields |
# |
Mar 26th 2019, 16:12 |
devito |
or is that just to get the rest of the fields as well as the calculated field |
# |
Mar 26th 2019, 16:12 |
devito |
do i need to pass in the table obj to the select like it is doing on that last select? |
# |
Mar 26th 2019, 16:11 |
neon1024 |
Although you might need to use HAVING I think :thinking_face: |
# |
Mar 26th 2019, 16:11 |
neon1024 |
Yep |
# |
Mar 26th 2019, 16:11 |
devito |
rightso with this i should now be able to access slug in a where condition righ |
# |
Mar 26th 2019, 16:10 |
neon1024 |
You don’t need to pass in a query object |
# |
Mar 26th 2019, 16:10 |
devito |
right |
# |
Mar 26th 2019, 16:10 |
neon1024 |
Yeah, it’s just sql language agnostic concat |
# |
Mar 26th 2019, 16:10 |
devito |
``` // Only all fields from the articles table including // a calculated slug field. $query = $articlesTable->find(); $query ->select(['slug' => $query->func()->concat(['title' => 'identifier', '-', 'id' => 'identifier'])]) ->select($articlesTable); // Select all fields from articles ``` |
# |
Mar 26th 2019, 16:08 |
devito |
https://book.cakephp.org/3.0/en/orm/query-builder.html#selecting-specific-fields |
# |
Mar 26th 2019, 16:05 |
devito |
sure 1 sec |
# |
Mar 26th 2019, 16:04 |
neon1024 |
Can you link us to the part in the docs? Or share the code here? |
# |
Mar 26th 2019, 16:04 |
neon1024 |
A closure? |
# |
Mar 26th 2019, 16:03 |
devito |
in the docs theres an additional select method that has the table object passed through to it |
# |
Mar 26th 2019, 16:03 |
devito |
yes |
# |
Mar 26th 2019, 16:02 |
neon1024 |
“Creating a column” do you mean a calculated select field? |
# |
Mar 26th 2019, 16:01 |
devito |
i am trying with creating the col in the select than just writing a where clause and i get column doesnt exist |
# |
Mar 26th 2019, 16:00 |
neon1024 |
`$this->Site->nukeFrom($orbit, $toBeSure);` |
# |
Mar 26th 2019, 16:00 |
devito |
eate a calculated column, do i need to pass in the query object to the select function so that the where conditions can have access to that new column? |
# |
Mar 26th 2019, 15:49 |
josbeir |
$this->Cookie->delete('hello'); ? |
# |
Mar 26th 2019, 15:42 |
steinkel |
https://github.com/CakeDC/users-example this one for a demo using CakeDC/Users |
# |
Mar 26th 2019, 15:41 |
steinkel |
you can check this one too https://github.com/CakeDC/training-unit-tests |
# |
Mar 26th 2019, 15:41 |
steinkel |
https://github.com/gothinkster/cakephp-realworld-example-app this one is a bit outdated |
# |
Mar 26th 2019, 15:29 |
paul_83uk |
Whats the correct way to delete a cookie in cakephp 3.7? |
# |
Mar 26th 2019, 15:28 |
dereuromark |
on patch Entity you shouldnt need to afaik, as there it comes from relations (and therefore the aliases) |
# |
Mar 26th 2019, 15:28 |
dereuromark |
rogerpro: Yes, you need to call plugin classes using the dot syntax to find them |
# |
Mar 26th 2019, 15:27 |
dereuromark |
Albatros: Check with hydration false, and compara the times. if thats it, then you know what the issue is. |
# |
Mar 26th 2019, 15:24 |
rogerpro |
So far I found that `Cake\ORM\TableRegistry::get('Bars');` is building the table with magic, not using any plugin until called like `Cake\ORM\TableRegistry::get('PluginName.Bars');` |
# |
Mar 26th 2019, 15:17 |
rogerpro |
My goal is to test associations, since `patchEntity()` is not saving an associated model. Does data in plugins always need `Plugin.Table` notation? |