# |
Aug 15th 2019, 10:12 |
challgren |
I thought you had cake 2 on cake 3 on cake 1! :P |
# |
Aug 15th 2019, 10:12 |
neothermic |
can we keep the jokes about 2.x being old until after it gets dropped from support? :P |
# |
Aug 15th 2019, 10:09 |
challgren |
@mrfeedback thanks for the sample! I was trying to figure out Policies |
# |
Aug 15th 2019, 10:09 |
mrfeedback |
thank you! |
# |
Aug 15th 2019, 10:09 |
mrfeedback |
oh man! you saved me again! overlooked that completley |
# |
Aug 15th 2019, 10:04 |
ndm |
@mrfeedback ``` // Policy/CollectionsTablePolicy.php namespace App\Policy; namespace App\Model\Table\CollectionsTable; // <<<<<<<<<< that's not supposed to be there ``` |
# |
Aug 15th 2019, 09:59 |
mrfeedback |
I could need some advice why I get this error thrown `Error: [Authorization\Policy\Exception\MissingPolicyException] Policy for `App\Model\Table\CollectionsTable` has not been defined.` I am sure I missunderstood something in docs |
# |
Aug 15th 2019, 09:58 |
ndm |
@jotpe You can authorize against anything that your policy resolvers can provide a policy for... with the default ORM resolver you can authorize entities, tables, and queries (which is basically tables). So you may want to look into a table policy. |
# |
Aug 15th 2019, 09:58 |
slackebot |
<challgren> |
# |
Aug 15th 2019, 09:55 |
slackebot |
<neon1024> |
# |
Aug 15th 2019, 09:54 |
challgren |
cake 2.x?? |
# |
Aug 15th 2019, 09:15 |
neothermic |
(in cake2) |
# |
Aug 15th 2019, 09:15 |
neothermic |
is there any way to get Cakelog::write to not echo to stdout when running unit tests? |
# |
Aug 15th 2019, 09:14 |
lubos |
@admad found the reason, when you do `formatResults` with finder on associated model (e.g. Offers) it sets `offer` property as dirty even when no change is done to `$results` so later on when I tried to save it was trying to save `offer` property which I did not expect :slightly_smiling_face: |
# |
Aug 15th 2019, 09:09 |
neon1024 |
Ah, I knew if I asked, I’d find it right away! https://github.com/dereuromark/cakephp-hashid |
# |
Aug 15th 2019, 09:09 |
neon1024 |
Anyone know where dereuromark’s plugin is which adds an obfuscation slug layer |
# |
Aug 15th 2019, 09:04 |
jotpe |
https://book.cakephp.org/authorization/1.1/en/checking-authorization.html -> there it's checked with the entity `$user->can('delete', $article)` |
# |
Aug 15th 2019, 09:03 |
jotpe |
In fact i want to enable an admin user to access all actions in a controller. But in an index action i don't have an entity |
# |
Aug 15th 2019, 09:02 |
jotpe |
How do i check the authorization for a index action in Authroization Plugin? |
# |
Aug 15th 2019, 08:41 |
spriz |
not afaik |
# |
Aug 15th 2019, 08:39 |
hmic |
oh, ah, does crud and crudview implement it on their own? |
# |
Aug 15th 2019, 08:38 |
hmic |
yeah, this paginator could use some serious love... |
# |
Aug 15th 2019, 08:38 |
hmic |
I need to report the total number back, it's API usage |
# |
Aug 15th 2019, 08:32 |
spriz |
the consumer just keeps doing `+1` to the `page` param, until a 404 is returned :) |
# |
Aug 15th 2019, 08:31 |
spriz |
we do that for heavy queries |
# |
Aug 15th 2019, 08:31 |
spriz |
or skip them :) |
# |
Aug 15th 2019, 08:31 |
spriz |
I made custom paginators a few time - it's not too much of a hassle :slightly_smiling_face: |
# |
Aug 15th 2019, 08:31 |
admad |
if those lines were rejigged a bit and the fetching of count was moved into separate method once could override that method and return count as per their custom needs |
# |
Aug 15th 2019, 08:29 |
admad |
https://github.com/cakephp/cakephp/blob/master/src/Datasource/Paginator.php#L185-L188 |
# |
Aug 15th 2019, 08:29 |
hmic |
yep, i figured that :p :( |
# |
Aug 15th 2019, 08:27 |
admad |
okay. currently `Paginator` just clones the primary query and does a `count()` on in instead of `all()` and everything is inside `Paginator::paginate()` so not very flexible |
# |
Aug 15th 2019, 08:23 |
hmic |
filter all of them, of course. so the paginator calling ->count() can't be done on the query but the resulting collection only. i am aware of the imact of it. I am just looking for a place to add/configure it to work *at all( |
# |
Aug 15th 2019, 08:21 |
admad |
i really don't see a solution to the problem.. how can you find out even the correct total count since the filtering of records would be done per page |
# |
Aug 15th 2019, 08:18 |
hmic |
I am not able to get all the data this virtual field contains in the query/db, it represents external shit. |
# |
Aug 15th 2019, 08:17 |
admad |
trying to get proper count after query is done would be PITA |
# |
Aug 15th 2019, 08:17 |
admad |
hmic: i believe the best way would be do the filtering in query itself |
# |
Aug 15th 2019, 08:13 |
hmic |
I looked into mapReduce but can't figure that (and if it would solve the paginator count issue) |
# |
Aug 15th 2019, 08:12 |
hmic |
general question: how to filter results on a virtual field (and get correct counts from the paginator)? |
# |
Aug 15th 2019, 08:11 |
hmic |
any ideas? |
# |
Aug 15th 2019, 08:11 |
hmic |
I do understand the reason behind it and am looking for another solution now. |
# |
Aug 15th 2019, 08:10 |
hmic |
*but* there is a catch on this: the paginator count is wrong |