# |
Apr 20th 2021, 19:21 |
joacir.santos |
Greetings! I think I´m in trouble with "subquerys" using cake4. I read all documentation ORM sections, but I not found it. How can I get a count field from a association table in paginate? In tried, but dont work: ```$views = $this->Pages->getAssociation('Views')->find(); $this->paginate['fields']['views_count'] = $views ->select('Views.id') ->count(); $records = $this->paginate();``` |
# |
Apr 20th 2021, 15:40 |
steinkel |
yeah people is getting tired of frontend frameworks I guess... back to the monolith! |
# |
Apr 20th 2021, 15:36 |
jh |
@steinkel also take not of websockets and ssr aka phoenix live view |
# |
Apr 20th 2021, 15:30 |
steinkel |
@jh I've been following this trend (swoole/fibers) and I'm very interested too. Some time ago I played a bit with reactphp+cakephp and it produced very interesting results |
# |
Apr 20th 2021, 15:20 |
jujni |
hello |
# |
Apr 20th 2021, 14:37 |
slackebot |
like Laravel and Symfony? |
# |
Apr 20th 2021, 14:37 |
jh |
> Meanwhile, there's also Swoole — a PHP extension that actually modifies several core functions to be non-blocking. Swoole itself is a Chinese project and often not very well documented when it comes to English, but recently Laravel announced first party-integration with it. Maybe this is the better strategy when it comes to moving PHP towards a more async model: optionally integrate Swoole or other extensions with frameworks |
# |
Apr 20th 2021, 13:35 |
kevin.pfeifer |
you need to url encode the search parameter |
# |
Apr 20th 2021, 13:30 |
etibor |
is it possible to redirect only a prefix to different prefix? |
# |
Apr 20th 2021, 13:30 |
etibor |
hello there |
# |
Apr 20th 2021, 11:43 |
k4t |
should this be fixed via htaccess? |
# |
Apr 20th 2021, 11:42 |
k4t |
Hi all I hope you will be able to help me. In our project which is based on CakePHP 2 we have search links like: /search/:query. Unfortunatelly when user search for "%" url will look like: /search/% which is causing error 400 becuase "%" is not allowed in the url. Could you please give me some hint how can I fix it? |
# |
Apr 20th 2021, 11:12 |
ndm |
@david Check Debug Kit's SQL panel, or manually use its SQL dumping functionality, eg `\DebugKit\DebugSql::sql()`. To see what _actually_ finally runs, you'd have to log the queries at your SQL server. |
# |
Apr 20th 2021, 11:02 |
david |
using ->sql() doesn't replace the c: vars in the query |
# |
Apr 20th 2021, 11:01 |
david |
is there any way to view the executed query? |
# |
Apr 20th 2021, 10:59 |
david |
morning |
# |
Apr 20th 2021, 09:07 |
nils |
Nevermind, got it |
# |
Apr 20th 2021, 09:03 |
nils |
Still on 2.x - what’s the best way to loadModel when running something from the shell? It doesn’t seem to be working |
# |
Apr 20th 2021, 08:47 |
nayakvradhit |
Folder structure is appname/Controller/Polygons/PolygonController.php inside this I am having lowpoly function Currently script src =" /polygons/lowpoly" Dosent work |
# |
Apr 20th 2021, 08:46 |
nayakvradhit |
I set the website to /var/www/html and I am calling ipaddress/appname |
# |
Apr 20th 2021, 08:45 |
nayakvradhit |
Can anyone please help how to call a function of controller in JavaScript src tag in. Ctp file? |
# |
Apr 20th 2021, 05:17 |
conehead |
@rightscoreanalysis True, not sure where it went. You can still find the list here: https://github.com/cakephp/cakephp/blob/master/src/View/Helper/FormHelper.php#L88 |
# |
Apr 20th 2021, 03:32 |
davinci |
trying to run a shell script (cake 2.x), and it's saying it can't find a table that is definitely there. Have tried clearing tmp/model/ What else could I be missing? |
# |
Apr 19th 2021, 22:31 |
rightscoreanalysis |
not sure if the link is wrong or the list has been moved |
# |
Apr 19th 2021, 22:30 |
rightscoreanalysis |
But that list is no longer found in the linked resource https://api.cakephp.org/3.9/class-Cake.View.Helper.FormHelper.html#%24_defaultConfig |
# |
Apr 19th 2021, 22:30 |
rightscoreanalysis |
"The list of default templates, their default format and the variables they expect can be found in the FormHelper API documentation." |
# |
Apr 19th 2021, 22:30 |
rightscoreanalysis |
there use to be alink in the book to a list of the form template that can be modified in the app_form.php |
# |
Apr 19th 2021, 19:24 |
hello106 |
Thanks Kevin, I’ll check those out more thoroughly, I’ve used them a little before but not heavily |
# |
Apr 19th 2021, 19:11 |
kevin.pfeifer |
i just personally really like utility classes (and the way they integration with dependency injection) |
# |
Apr 19th 2021, 19:10 |
kevin.pfeifer |
i would just recommend you to stick with one method and dont mix/match too much to micro-optimize |
# |
Apr 19th 2021, 19:10 |
hello106 |
Thank you, I think the BasePolicy seems a good sounding route, it’s quite minor but grates on me having the function repeated - appreciate all the notes |
# |
Apr 19th 2021, 19:09 |
kevin.pfeifer |
there is just no “predefined” way the authorization plugin / cakephp recommends you |
# |
Apr 19th 2021, 19:08 |
kevin.pfeifer |
there are many ways to organize code :) |
# |
Apr 19th 2021, 19:08 |
kevin.pfeifer |
or create a trait |
# |
Apr 19th 2021, 19:08 |
kevin.pfeifer |
you could also create a `BasePolicy` which your needed Policies extend from |
# |
Apr 19th 2021, 19:07 |
sebastiansperandio093 |
you could add a custom finder and get other data related to the user |
# |
Apr 19th 2021, 19:02 |
hello106 |
Thank you @kevin.pfeifer - if its only looking at the User Identity, is that still where you would add it? (for info, it would all be based on the users role only) |
# |
Apr 19th 2021, 19:00 |
kevin.pfeifer |
use a utility class |
# |
Apr 19th 2021, 18:52 |
hello106 |
Would anyone have any advice on where best to put a function used across various entity policies (we’re using the Cake Authorization plugin)? Like the `isAuthor()` in the example https://book.cakephp.org/4/en/tutorials-and-examples/cms/authorization.html#creating-our-first-policy but that can be defined once and then used in multiple policy? |
# |
Apr 19th 2021, 18:46 |
sebastiansperandio093 |
'serialize', ['data'] |
# |
Apr 19th 2021, 18:45 |
sebastiansperandio093 |
just in case, could you try to pass the second parameter as an array? |