# |
Feb 17th 2020, 16:32 |
dan874 |
so im just wondering if the size of the model is causing an issue with the request as its loading in a number of contains at the same time. |
# |
Feb 17th 2020, 16:32 |
dan874 |
as in i go through the session is maintained correctly and it all works |
# |
Feb 17th 2020, 16:32 |
dan874 |
so if i remove the $request->withParam line everything works as expected |
# |
Feb 17th 2020, 16:31 |
ndm |
Even if someone had done something like that, it wouldn't necessarily help to figure what might be happening in your application. It would probably be better if you elaborated on the latter. What is that particular route and set of data? What does "_blowing up_" exactly mean? What does your error logs say? ... |
# |
Feb 17th 2020, 16:23 |
dan874 |
and this allows us to typehint entities on the controllers |
# |
Feb 17th 2020, 16:23 |
slackebot |
$request->getParam('_matchedRoute')); $paramIndex = array_search($parameter, $passedParams, true); if (!empty($paramIndex)) { return $request->withParam('pass.' . ($paramIndex - 1), $model); } return $request; }``` |
# |
Feb 17th 2020, 16:23 |
dan874 |
at the core its just ``` /** * Bind the model to the route as part of the request * * @param ServerRequestInterface $request * @param Entity $model * @param string $parameter * @return ServerRequestInterface */ public function bindModelToRoute( ServerRequestInterface $request, Entity $model, string $parameter )ServerRequestInterface { $passedParams = explode('/:', |
# |
Feb 17th 2020, 16:22 |
flashios09 |
sorry i don’t know anything about Laravel, i haven’t used any other php framework |
# |
Feb 17th 2020, 16:21 |
dan874 |
but looking at it, this is what seems to be causing the issue with my session now as for some reason on a particular route with a particular set of data its blowing it up. |
# |
Feb 17th 2020, 16:21 |
dan874 |
sorry its a laravel term. basically if i have a model called user and in the route i have a `userId` then what ive done is in a middleware swap that user id out with the user so in the controller i can typehint the user entity |
# |
Feb 17th 2020, 16:20 |
flashios09 |
@dan874 what do you mean by *route model binding* ? |
# |
Feb 17th 2020, 16:19 |
flashios09 |
change `posts` with your table name |
# |
Feb 17th 2020, 16:19 |
flashios09 |
```SELECT Posts.id AS `Posts__id`, 1 AS `my_filter`, DATE(modified) AS `modified_date` FROM posts Posts``` |
# |
Feb 17th 2020, 16:18 |
dan874 |
has anyone ever tried to setup route model binding in cakephp? |
# |
Feb 17th 2020, 16:17 |
flashios09 |
try to execute the query manually (copy/paste it) |
# |
Feb 17th 2020, 16:15 |
flashios09 |
@shifat.it both works for me |
# |
Feb 17th 2020, 16:08 |
shifat.it |
Following code works ``` ->select([ 'id', 'my_filter' => 1, 'modified_date' => 'DATE(modified)', ])``` But following doesn't works ``` ->select([ 'id', 'my_filter' =>"1", 'modified_date' => 'DATE(modified)', ])``` why? latter one shows column doesnt exist |
# |
Feb 17th 2020, 16:07 |
flashios09 |
where can i ask about FriendsOfCake/crud-json-api ? |
# |
Feb 17th 2020, 16:06 |
flashios09 |
hi |
# |
Feb 17th 2020, 15:58 |
admad |
@dan874 if you are using default file based session make sure you haven't run out disk space |
# |
Feb 17th 2020, 15:54 |
dan874 |
it gets all the way to read from the session storage for `Auth.User` and blows up |
# |
Feb 17th 2020, 15:54 |
dan874 |
its just odd as this has literally just started to happen when it was stable for about a month and a half |
# |
Feb 17th 2020, 15:53 |
dan874 |
so its trying to read for the logged in user using the AuthComponent. |
# |
Feb 17th 2020, 15:52 |
k4t |
check your logs first, you can have more detailes info there |
# |
Feb 17th 2020, 15:51 |
dan874 |
just trying to figure out i there is something going on in a before filter that might be causing it |
# |
Feb 17th 2020, 15:50 |
k4t |
what do you have in cakephp logs? |
# |
Feb 17th 2020, 15:47 |
dan874 |
has anyone ever come across an issue where a simple redirect would cause a session to stop working? for some reason im not getting `Error: [RuntimeException] Could not start the session` when hitting the new page after the redirect and im then logged out. |
# |
Feb 17th 2020, 15:43 |
willem |
with a table setup like so. how would i get the full history in a cake query? |
# |
Feb 17th 2020, 15:42 |
slackebot |
who fill give me ready solution and do whole work for me. Looking for advices/hints. Thank you! |
# |
Feb 17th 2020, 15:42 |
k4t |
can you recommend some kind of tutorial/articles/examples in which I can read about good practices for implementing data filtering? You know, in my project I have 3 dropdowns: dates, products, products type. Date and Product Type filters should add/remove query string parameter from url. Products filter contains normal links to each product but it should keep query string filters from Dates and Products Type filters. I am not looking for someone |
# |
Feb 17th 2020, 15:38 |
k4t |
Hello |
# |
Feb 17th 2020, 13:52 |
dereuromark |
Also the respective docs then per use case. |
# |
Feb 17th 2020, 13:52 |
dereuromark |
Did you read the above articles in detail? That should answer this very question. |
# |
Feb 17th 2020, 13:50 |
md.islam11 |
can i call a function of table in select() ? |
# |
Feb 17th 2020, 13:49 |
md.islam11 |
Any way to get in select-() |
# |
Feb 17th 2020, 13:49 |
dereuromark |
It works if you call this on the entity, has nothing to do with queries and select() though |
# |
Feb 17th 2020, 13:48 |
md.islam11 |
```protected $_virtual = [ 'type_string' ];``` ```public function _getTypeString() { return "test"; }``` I did this in my entity and its not working |
# |
Feb 17th 2020, 13:43 |
dereuromark |
funny enough exactly a year distance between em^^ |
# |
Feb 17th 2020, 13:42 |
dereuromark |
read the docs, or https://www.dereuromark.de/2019/02/05/virtual-entity-fields-in-cakephp/ + https://www.dereuromark.de/2020/02/06/virtual-query-fields-in-cakephp/ |
# |
Feb 17th 2020, 13:42 |
md.islam11 |
how to achieve this? |
# |
Feb 17th 2020, 13:42 |
md.islam11 |
can you please help me with an example. |