-
Notifications
You must be signed in to change notification settings - Fork 27
[WIP] Create custom behavior for RouteNotFoundException #177
Conversation
$queryBuilder = $routeRepository->createQueryBuilder('r'); | ||
$queryBuilder->getChildren(); | ||
$queryBuilder->where('r.id = '.$parentUri); | ||
$routes = $queryBuilder->getQuery(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some query profs out there to help me to optimize/repair those queries.
@dbu in generall this PR is very far away from ready. Just wanted to ask for some help with the querries. Got my first esxperiences with the orm querybuilder and never used the odm one. What i plan is:
Not sure atm if it would be enough to simple set/overwrite the ExceptionController on |
Maybe i would provide a "you can go to" collection in configuration or We would just keep that in the template. |
Yea i changed a little bit: Instead of putting the "best matchers" into the configuration by some shortcut or something else. I decided to create tags for them.Those Todo: see description on the top. |
@@ -1,6 +1,7 @@ | |||
Changelog | |||
========= | |||
|
|||
* **2014-02-08**: Custom exception controller for error handling |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we use european dates, not the confused american ones ;-) so its YYYY-MM-DD
Beside the implementation of both matcher i would like to server, i can't test the Frontend. For some reason the |
It should be |
But it is: That was my reason to ask. @wouterj does the |
public function create(Request $request) | ||
{ | ||
// TODO: Implement create() method. | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somebody (@dantleech, @lsmith77) any hints to build a good and fast query for getting all ancestors?
parent -> all children?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you don't want to use a query but instead want to use getChildren()
.. there is a method for this both on the PHPCR as well as the PHPCR ODM level. In both cases you first need to fetch the parent (node or document).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In ErrorHandling/AncestorBestMatcher.php:
+/**
- * This BestMatcher tries to create a route collection of
- * all ancestors of a given uri.
- * @author Maximilian Berghoff Maximilian.Berghoff@gmx.de
- */
+class AncestorBestMatcher extends PhpcrBestMatcher
+{
+- /**
\* {@inheritDoc}
*/
- public function create(Request $request)
- {
// TODO: Implement create() method.
- }
you mean this: https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/DocumentManager.php#L898
yes ..
} | ||
|
||
$uriAsArray = array_shift($uriAsArray); | ||
$parentUri = implode('/', $uriAsArray); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is there a nice reg. expression for that 7 lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PathHelper from phpcr-utils offers a method to get the parent path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bingo :-)
Will check the But need to get rid of the problem with the template loading first. |
imho functional tests that test the behaviour of this bundle and not |
i just wanted to do a |
think i have fixed the template problem. Need to write some better tests now and then this one is ready. |
ping |
Something went badly wrong here. I can't fix it with a rebase. @ElectricMaxxx since you know which commits belong to this PR and which don't, you can create a new branch based on master and cherry-pick the commits of this PR into that new branch and start a new PR. |
Ok. But the most important: the test go green. |
btw .. I fixed the tests in master |
created follow up in #192 |
Todo:
create()
methods of the base matcher i created (parent, ancestor)BestMatcherPresentation
to use the custom exception.html.twig i createdBestMatcherPresentation