# |
Sep 23rd 2019, 15:28 |
ckjksl |
Because for your first case, I don't think routing should be responsible for redirect if it depends on database results |
# |
Sep 23rd 2019, 15:28 |
daniel.upshaw |
Since 404 is an exception... But it seems hacky |
# |
Sep 23rd 2019, 15:27 |
daniel.upshaw |
Maybe a `try...catch` could do it |
# |
Sep 23rd 2019, 15:27 |
daniel.upshaw |
Since the routing halts with the response from the first matched route connected controller |
# |
Sep 23rd 2019, 15:27 |
daniel.upshaw |
Well there would be another controller with a map of redirects, but it never gets to check it |
# |
Sep 23rd 2019, 15:26 |
ckjksl |
Sounds like it needs to either get to a controller or get to a 404. Could you decide after you hit your criteria before you return a response? Like another controller with a map of redirects? |
# |
Sep 23rd 2019, 15:26 |
daniel.upshaw |
After that, it could be safe to assume a 404 response... but not until all the appropriate routes have matched, right? |
# |
Sep 23rd 2019, 15:26 |
daniel.upshaw |
Even though the first controller didn't find content, the redirect controller might find a match |
# |
Sep 23rd 2019, 15:26 |
daniel.upshaw |
For example, maybe there's another controller with a map of redirects |
# |
Sep 23rd 2019, 15:25 |
daniel.upshaw |
You might return a 404 response if there's no match.... *but*.... what if you want to continue routing? |
# |
Sep 23rd 2019, 15:25 |
daniel.upshaw |
@ckjksl good question. So, for example, say you have a controller that pulls content from the database, if it finds a matching path, it returns a response |
# |
Sep 23rd 2019, 15:24 |
ckjksl |
I'm wondering, what are all the possible reasons why a matching route might not have a response? |
# |
Sep 23rd 2019, 15:23 |
daniel.upshaw |
They're confusing, seems like there ought to be a way |
# |
Sep 23rd 2019, 15:23 |
daniel.upshaw |
Lol s'okay, me too pretty much |
# |
Sep 23rd 2019, 15:22 |
ricksaccous |
i dunno i'm bad with routes, lol |
# |
Sep 23rd 2019, 15:22 |
ricksaccous |
oh |
# |
Sep 23rd 2019, 15:22 |
daniel.upshaw |
It seems like it ought to be possible for more than one controller to check dynamic route paths |
# |
Sep 23rd 2019, 15:20 |
daniel.upshaw |
Well the outer function is `Router::scope('/', function...)` |
# |
Sep 23rd 2019, 15:20 |
daniel.upshaw |
Well see how this is scoped to `/*` @ricksaccous |
# |
Sep 23rd 2019, 15:20 |
daniel.upshaw |
Mmm |
# |
Sep 23rd 2019, 15:18 |
ricksaccous |
doesn't scoping solve this problem? |
# |
Sep 23rd 2019, 15:17 |
ckjksl |
if it's a very deep tree, or there are posts that are part of multiple trees, you might consider using a tag system |
# |
Sep 23rd 2019, 15:17 |
daniel.upshaw |
If you `return false` from a custom routing class, it does have that effect... but trying to figure out how to achieve something similar from a connected controller |
# |
Sep 23rd 2019, 15:16 |
ckjksl |
I'm doing something similar. It depends on how deep your tree goes. For me, my tree is only 1 deep guaranteed, so I just have a parent_id field. If parent_id is not empty, then I find everything that has the same parent_id, plus the actual parent_id item. |
# |
Sep 23rd 2019, 15:15 |
daniel.upshaw |
E.g., that'll catch everything, but say that controller doesn't have an appropriate response, but a route further down might |
# |
Sep 23rd 2019, 15:15 |
daniel.upshaw |
Trying to think of a good way to *continue routing* if the controller for the first matching route determines that it doesn't have a response: `$routes->connect('/*', ['controller' => 'Pages', 'action' => 'display']);` |
# |
Sep 23rd 2019, 15:11 |
ricksaccous |
nevermind i found an example here: http://mark-story.com/posts/view/introducing-the-cakephp-authorization-plugin |
# |
Sep 23rd 2019, 15:08 |
ricksaccous |
for policy scopes what would have to be done to actually apply the scope to the query in the index action https://book.cakephp.org/authorization/1.1/en/policies.html#policy-scopes |
# |
Sep 23rd 2019, 14:18 |
Guest87544 |
Hi All, how can I get posts with term parent id where they are related to categories with a treebehavior. Example: I would found all posts using the A term id where there is some posts related to a term B (B is a child of A). |
# |
Sep 23rd 2019, 13:31 |
ricksaccous |
oh alright |
# |
Sep 23rd 2019, 13:30 |
marek.sebera |
@ricksaccous yes, but the config provided classes need to subclass (extend) correct ones from the CORE, which should be those I named |
# |
Sep 23rd 2019, 13:29 |
ricksaccous |
can't you specify your own classes in the config so you don't necessarily have to over-ride but can create your own? |
# |
Sep 23rd 2019, 13:28 |
marek.sebera |
Hi, if I want to log exceptions/errors within DB but want to save along some context (such as form data, url, user auth details), i need to override both ExceptionRenderer and BaseLog, is that right? |
# |
Sep 23rd 2019, 13:27 |
alexdd55976 |
on the other hand, it was perfect with customers... |
# |
Sep 23rd 2019, 13:25 |
ricksaccous |
by the way, i grabbed mcdonalds in your car and found your secret bossman |
# |
Sep 23rd 2019, 13:24 |
alexdd55976 |
@ricksaccous super weird. but was fun that he didn't understand why he lost all his stupid discussions. |
# |
Sep 23rd 2019, 13:23 |
itmpls |
oh |
# |
Sep 23rd 2019, 13:23 |
ricksaccous |
is my guess |
# |
Sep 23rd 2019, 13:23 |
ricksaccous |
it won't recognize the actual table as it's being aliased in the query |
# |
Sep 23rd 2019, 13:23 |
ricksaccous |
SubmissionUsers.user_id |
# |
Sep 23rd 2019, 13:23 |
ricksaccous |
I think you have to name the field like |