# |
Oct 11th 2019, 13:17 |
jeremy.halin |
I hate cache in dev environment |
# |
Oct 11th 2019, 13:16 |
jeremy.halin |
:,) |
# |
Oct 11th 2019, 13:16 |
slackebot1 |
<josbeir> |
# |
Oct 11th 2019, 13:16 |
josbeir |
i guess the cache does not get cleared after running migrations :P |
# |
Oct 11th 2019, 13:16 |
jeremy.halin |
I use cakephp migrations |
# |
Oct 11th 2019, 13:16 |
josbeir |
it caches the table keys |
# |
Oct 11th 2019, 13:16 |
jeremy.halin |
thats weird |
# |
Oct 11th 2019, 13:15 |
jeremy.halin |
:( |
# |
Oct 11th 2019, 13:15 |
jeremy.halin |
@josbeir wow thanks... |
# |
Oct 11th 2019, 13:15 |
slackebot1 |
<jeremy.halin> |
# |
Oct 11th 2019, 13:15 |
josbeir |
bin/cake cache clear_all |
# |
Oct 11th 2019, 13:15 |
josbeir |
did you clear the cache |
# |
Oct 11th 2019, 13:14 |
jeremy.halin |
@ndm @aivaras.godliauskas `beforeSave` is working but when I assign a value to my column `start_at_utc`, it's not saved to DB (column is in `accessible` array) |
# |
Oct 11th 2019, 13:11 |
scuadra |
@ndm thank you very much. :slightly_smiling_face: |
# |
Oct 11th 2019, 13:05 |
ndm |
Also it should be `Countries.name` if association is named `Countries` |
# |
Oct 11th 2019, 13:04 |
ndm |
Fields of associated tables need to be whitelisted: https://book.cakephp.org/3.0/en/controllers/components/pagination.html#control-which-fields-used-for-ordering |
# |
Oct 11th 2019, 13:02 |
scuadra |
Hello. I am using Cake 3.7. Let's say I have tables products and countries (Products belongsTo Countries). So I want to paginate my Products and be able to sort them by Country name. But when I try to use $this->Paginator->sort('Country.name') or $this->Paginator->sort('country.name') in my view the results are not sorted by Country. Where am I wrong? |
# |
Oct 11th 2019, 12:58 |
slackebot1 |
<jotpe> |
# |
Oct 11th 2019, 12:58 |
jotpe |
Thanks @ndm, this was the change i needed to do: |
# |
Oct 11th 2019, 12:53 |
jeremy.halin |
sorry, 37/5000 maybe I spoke too fast :slightly_smiling_face: |
# |
Oct 11th 2019, 12:52 |
jeremy.halin |
@aivaras.godliauskas @ndm nope, not working :( |
# |
Oct 11th 2019, 12:35 |
ndm |
@jeremy.halin You can, give it a try |
# |
Oct 11th 2019, 12:35 |
aivaras.godliauskas |
@jeremy.halin i believe only ```beforeSave``` is enough |
# |
Oct 11th 2019, 12:35 |
ndm |
@rchavik That's years before `cakephp/authentication` and `cakephp/authorization` even existed... maybe you were referring to something I don't see over here. |
# |
Oct 11th 2019, 12:34 |
jeremy.halin |
or do I need a behavior ? |
# |
Oct 11th 2019, 12:32 |
jeremy.halin |
@ndm thanks, can I just create a `beforeSave` function in my `table` ? |
# |
Oct 11th 2019, 12:31 |
ndm |
@jeremy.halin https://book.cakephp.org/3.0/en/orm/behaviors.html#defining-event-listeners https://book.cakephp.org/3.0/en/tutorials-and-examples/bookmarks/part-two.html#persisting-the-tag-string |
# |
Oct 11th 2019, 12:21 |
jeremy.halin |
Hi, I would like to create and save a column value based on another automatically. I have a local time in a column and want to store that same time but converted to UTC in another column. Rather than doing so in each save or update, I would like to make it automatic. I've seen https://book.cakephp.org/3.0/en/orm/table-objects.html#lifecycle-callbacks but it's unclear for me. Anyone with a concrete example please ? Thanks. |
# |
Oct 11th 2019, 12:14 |
ndm |
@jotpe It may help if you'd show your code... have you checked https://github.com/cakephp/authorization/issues/79 ? |
# |
Oct 11th 2019, 12:14 |
ndm |
That's... a totally different question ;) Look at for example https://github.com/UseMuffin/Footprint, injecting the data via events is usually the way to go. |
# |
Oct 11th 2019, 11:29 |
rochasmarcelo |
In your controller, ``` $user = $this->Auth->user(); ``` or ```$userId = $this->Auth->user('id');``` |
# |
Oct 11th 2019, 11:26 |
jotpe |
How can i solve this |
# |
Oct 11th 2019, 11:25 |
jotpe |
I implement `Authentication\IdentityInterface` and `Authorization\IdentityInterface` on my user |
# |
Oct 11th 2019, 11:25 |
jotpe |
If I use Authentication with Authorization Plugin with a custom Deocrator on my User I get `Call to undefined method Authentication\Identity::setAuthorization()` |
# |
Oct 11th 2019, 09:59 |
jotpe |
(E.g. If I have different user groups) |
# |
Oct 11th 2019, 09:59 |
johnwayne |
@ndm thanx, `$getAllOpenOrders->toArray()` was the problem (it was not the array |
# |
Oct 11th 2019, 09:59 |
jotpe |
For the Authorization Plugin: I have several Policies and a AdminPolicy which implements BeforePolicyInterface to grant Admin Access. For now I extend all my Policies, but I wonder if there's a more advanced solution? |
# |
Oct 11th 2019, 09:32 |
ndm |
Are you sure that this is the query that is causing it? Also are you sure `$getAllOpenOrders` is an array (and not maybe a query)? And what is `$status`? What exactly does the generated SQL look like? That error usually happens when the table that you want to update is referenced in for example a join or a subquery. |
# |
Oct 11th 2019, 09:23 |
slackebot1 |
update in FROM clause` |
# |
Oct 11th 2019, 09:23 |
johnwayne |
Hi to all, if I try to update multiple records in the single table I am getting error... There is my Query ``` $updateAll = TableRegistry::getTableLocator()->get('Items') ->query() ->update() ->set(['status' => $status]) ->where(['order_id IN ' => $getAllOpenOrders]) ->execute(); $getAllOpenOrders = array with all relevant ids ``` The error is `You can't specify target table 'items' for |
# |
Oct 11th 2019, 09:07 |
peter |
im using cakephp 3 |