# |
Jul 21st 2021, 21:51 |
tyler.adam.lazenby |
instead of making the task go through each history (which there might be hundreds), I am going to make the system just create a new task for each history |
# |
Jul 21st 2021, 21:51 |
tyler.adam.lazenby |
hmmmmm, I have an idea |
# |
Jul 21st 2021, 21:16 |
grzes |
but i had a bug in counter cache condition and now i need to refresh all records after fixing the conditions |
# |
Jul 21st 2021, 21:02 |
kevin.pfeifer |
@grzes according to https://book.cakephp.org/4/en/orm/behaviors/counter-cache.html#basic-usage ```The counter's value will be updated each time an entity is saved or deleted. The counter will not be updated when you use updateAll() or deleteAll(), or execute SQL you have written.``` |
# |
Jul 21st 2021, 21:01 |
tyler.adam.lazenby |
I hate it when you have to build for large amounts of data! |
# |
Jul 21st 2021, 20:56 |
grzes |
how can i manually refresh counter cache? |
# |
Jul 21st 2021, 19:40 |
kevin.pfeifer |
the difference between cakephp 3 and 4 wouldn't be that much I would guess |
# |
Jul 21st 2021, 19:40 |
kevin.pfeifer |
maybe try https://github.com/mattmemmesheimer/cakephp-3-acl-example ? |
# |
Jul 21st 2021, 19:20 |
Aspirant |
Hi Everyone any great tutorial for implementation of ACL in cakphp 4.2.8 strawberry |
# |
Jul 21st 2021, 15:15 |
kevin.pfeifer |
you too :wave: |
# |
Jul 21st 2021, 15:14 |
Guest481 |
nice day/evening |
# |
Jul 21st 2021, 15:14 |
Guest481 |
have to leave |
# |
Jul 21st 2021, 15:14 |
Guest481 |
by the way |
# |
Jul 21st 2021, 15:08 |
Guest481 |
completely !! and i didn't follow the train because i moved to Azure and AWS cloud admin and without 3 years playing with theses frameworks...i'm now obsolete and back in that wolrd from scratch haha |
# |
Jul 21st 2021, 15:06 |
kevin.pfeifer |
well those modern frontend JS frameworks are a completely different topic :) |
# |
Jul 21st 2021, 15:05 |
Guest481 |
but i'm an old school jquery guy, not up to date on angular, vue etc.. |
# |
Jul 21st 2021, 15:05 |
Guest481 |
the most complicated is to create a beautiful interface |
# |
Jul 21st 2021, 15:04 |
Guest481 |
lol yes sometimes this is necessarry |
# |
Jul 21st 2021, 14:59 |
kevin.pfeifer |
I too myself just recently refactored a bunch of arrays and other primitive data from their respected classes into actual config arrays ,:) |
# |
Jul 21st 2021, 14:58 |
Guest481 |
yes for now i'll do like that and when my project will be more complete i'll tune all of that |
# |
Jul 21st 2021, 14:56 |
kevin.pfeifer |
but thats something you can pretty easiely adjust at a later time if you so desire |
# |
Jul 21st 2021, 14:55 |
kevin.pfeifer |
but as said from cnizzardini if these constants are "just" strings or integers then a config entry would be much easier to work with |
# |
Jul 21st 2021, 14:54 |
Guest481 |
many thanks for your precious advice |
# |
Jul 21st 2021, 14:53 |
kevin.pfeifer |
if you have logic which should be present in many controllers then sure, a component is meant for that But the moment you need that same logic somewhere else (e.g. inside a Command) the generic PHP Class approach is better |
# |
Jul 21st 2021, 14:51 |
kevin.pfeifer |
you shouldn't call controller methods from other parts in the framework because they are only meant to be invoked via URLs (/my-controller/my-function) You should rather refactor that logic inside your controller function into sort of generic class which then can be called from your controller or anywhere else you want. |
# |
Jul 21st 2021, 14:35 |
Guest481 |
a component is better maybe ? |
# |
Jul 21st 2021, 14:35 |
Guest481 |
hmm and to call a method from a controller ? |
# |
Jul 21st 2021, 14:33 |
kevin.pfeifer |
so `src/Utility/MyUtility.php` would have to have the Namespace `App/Utility` and can be accessed via `App/Utility/MyUtility::MY_CONSTANT` |
# |
Jul 21st 2021, 14:33 |
Guest481 |
yep you are right |
# |
Jul 21st 2021, 14:32 |
kevin.pfeifer |
src is mapped to the `App` namespace see composer.json |
# |
Jul 21st 2021, 14:32 |
Guest481 |
i would need to have a "use App\MyClass" at the beginning of my controller to use it ? |
# |
Jul 21st 2021, 14:31 |
Guest481 |
but if i imagine my class is in src: |
# |
Jul 21st 2021, 14:29 |
Guest481 |
hmm okay i'll give it a try |
# |
Jul 21st 2021, 14:27 |
cnizzardini |
You can create that class anywhere in `src/` that makes sense to you. You may also want to look at making this a configuration: https://book.cakephp.org/4/en/development/configuration.html |
# |
Jul 21st 2021, 14:26 |
Guest481 |
or maybe in Entity |
# |
Jul 21st 2021, 14:25 |
Guest481 |
any help would be apreciated |
# |
Jul 21st 2021, 14:25 |
Guest481 |
nothing found in the doc |
# |
Jul 21st 2021, 14:25 |
Guest481 |
i don't have any idea on where to create that class file (folder, etc) |
# |
Jul 21st 2021, 14:25 |
Guest481 |
by example, containing the following : CustomRole::SYSTEM_ADMIN |
# |
Jul 21st 2021, 14:24 |
Guest481 |
i would like to create a class which would have only the aim to provide constants |
# |
Jul 21st 2021, 14:23 |
Guest481 |
Hi everybody ! i have a doubt |