# |
Jun 21st 2019, 11:06 |
egalles |
now cakephp book recommends to use authorization and authentication plugins. |
# |
Jun 21st 2019, 11:05 |
egalles |
i was using authcontroller since now and i see in documentation that will be deprecated |
# |
Jun 21st 2019, 11:04 |
egalles |
good morning |
# |
Jun 21st 2019, 10:44 |
martin |
morning :) |
# |
Jun 21st 2019, 10:26 |
neon1024 |
Morning everyone |
# |
Jun 21st 2019, 10:14 |
conehead |
Oh, by the way...there are "dynamic finders" as well.... https://book.cakephp.org/3.0/en/orm/retrieving-data-and-resultsets.html#dynamic-finders You should be able to do the following: `$users->findAllByRole(1)->count()` But personally I am not a big fan of these magic methods |
# |
Jun 21st 2019, 09:36 |
conehead |
``` $users->find() ->where(['role' => 1]) ->count(); ``` |
# |
Jun 21st 2019, 09:34 |
kgb.acct.personal |
I have to get the total count and the count where role = 1 |
# |
Jun 21st 2019, 09:34 |
kgb.acct.personal |
Yess |
# |
Jun 21st 2019, 09:30 |
conehead |
I don't really get what you are trying to achive. Count all where `role = 1`) |
# |
Jun 21st 2019, 09:27 |
kgb.acct.personal |
It looks like this. But it seems hackish ``` $users->func()->count('DISTINCT CASE WHEN role = 1 THEN role END') ``` |
# |
Jun 21st 2019, 09:27 |
conehead |
https://book.cakephp.org/3.0/en/orm/table-objects.html#afterdelete |
# |
Jun 21st 2019, 09:27 |
kgb.acct.personal |
How do I do conditional count? |
# |
Jun 21st 2019, 09:26 |
conehead |
Well you could check in afterSave or afterSaveCommit |
# |
Jun 21st 2019, 09:12 |
peppejaripappalardo |
Hi guys, i need an help please. I adding muffin/trash behavior a run time into the controller, because i have many entity related and that can give problem if i put the behavior into the table, e.g. Historical View. I need to cascade soft-delete item, there is a way to append into the table AddBehavior if Users deleted entity is not null? |
# |
Jun 21st 2019, 07:36 |
graziel |
then its in link i gave : ) |
# |
Jun 21st 2019, 07:35 |
nuzulfikrie |
i am using the latest version |
# |
Jun 21st 2019, 07:35 |
graziel |
dont remember the older |
# |
Jun 21st 2019, 07:35 |
graziel |
in newer i think yes, https://github.com/cakephp/app/blob/master/config/routes.php#L58 |
# |
Jun 21st 2019, 07:27 |
nuzulfikrie |
my question now is does CAKEPHP CSRF is enabled by default ? . |
# |
Jun 21st 2019, 07:26 |
nuzulfikrie |
disabling this line 'code' $this->loadComponent('Csrf'); 'code' resolve error. |
# |
Jun 21st 2019, 07:26 |
nuzulfikrie |
hi team, need help. i am having ' CRSF token mismatch error ' on delete action. |
# |
Jun 21st 2019, 06:49 |
conehead |
Good morning everyone |
# |
Jun 21st 2019, 06:09 |
noypi2020 |
Hi, Good day! mod_rewrite is enabled on the server and the .htaccess files were intact. I cannot figure out where to fix those errors. |
# |
Jun 21st 2019, 04:19 |
joey.mukherjee |
Looks like this works! In case someone else searches for it: ` $routes->connect ('/:uuiid', ['controller' => 'Plots', 'action' => 'view']) ->setPatterns (['uuid' => '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}']);` |
# |
Jun 21st 2019, 04:11 |
joey.mukherjee |
Is there a better way of capturing a UUID from the url? |
# |
Jun 21st 2019, 04:03 |
joey.mukherjee |
I copied directly from that page in the book! That's how I got the errors. Ok, I also have this: `$routes->connect ('/**', ['controller' => 'Plots', 'action' => 'view']);` I need that since I want to pass a UUID on the url? |
# |
Jun 21st 2019, 03:59 |
mrfeedback |
@joey.mukherjee https://book.cakephp.org/3.0/en/development/routing.html#prefix-routing |
# |
Jun 21st 2019, 03:59 |
challgren |
Just do something like this @joey.mukherjee |
# |
Jun 21st 2019, 03:57 |
joey.mukherjee |
question about admin routing... If I want an admin prefix, I add ```Router::prefix('admin', function (RouteBuilder $routes) { $routes->connect ('/', ['controller' => 'admin', 'action' => 'index']); |
# |
Jun 20th 2019, 20:04 |
ricksaccous |
I think it's because I'm not using the OrmPolicy but the mapper policy which runs in the middleware before the controller is hit |
# |
Jun 20th 2019, 19:59 |
ricksaccous |
is not stopping the policy from happening |
# |
Jun 20th 2019, 19:59 |
ricksaccous |
my skipAuthorization method from my component |
# |
Jun 20th 2019, 19:59 |
ricksaccous |
hmmm |
# |
Jun 20th 2019, 19:53 |
ricksaccous |
actually i think i'll be fine pushing them back to their dashboard |
# |
Jun 20th 2019, 19:52 |
ricksaccous |
i suppose i'll just have to write a handle that extends redirect |
# |
Jun 20th 2019, 19:41 |
ricksaccous |
hmm |
# |
Jun 20th 2019, 19:41 |
ricksaccous |
there must be an easy way to redirect to referer |
# |
Jun 20th 2019, 19:40 |
ricksaccous |
https://book.cakephp.org/authorization/1.1/en/middleware.html#handling-unauthorized-requests |
# |
Jun 20th 2019, 18:06 |
mdotobie |
gotcha. well this actually might be a better way to do this |
# |
Jun 20th 2019, 18:05 |
admad |
Webservice is akin to db connection and Driver is akin to pdo driver |