-
Notifications
You must be signed in to change notification settings - Fork 48
[DX] Allow exceptions to be thrown during PhpcrProvider::has
#254
Comments
has
has
PhpcrProvider::has
i guess the problem is that we should not throw the exception in we could log a warning maybe? we could also provide a command to sanity check the repository: make sure there are routes under the route root, make sure there are menu nodes under the menu roots, maybe other similar things. but i don't see how we could improve this exception message, short of making the chain provider aware of phpcr and check for the specific situation, which feels strange. or expand on the menu providers to provide debugging information, probably with an additional interface that we can check for, if no menu was found and ask providers for debugging hints... |
Hmm, thinking of it, in my own situation I have Another idea would be to prefix the menu name with |
the prefix feels like leaking information to the application. the appeal of calling it just "main" is that i could switch the provider as needed without having to figure out where in the application i call this. indeed the sanity check idea probably does not work. but logging a warning could still work - once you request something as a menu, it is indeed supposed to be a menu. |
On Mon, May 23, 2016 at 02:32:08AM -0700, David Buchmann wrote:
There is already some pollution here as the template is coupled to the state It would make the intention explicit (which I like) and therefore enable But maybe a different issue is required to discuss and it could be |
If the provider cannot find the menu document then the error is thrown back to KnpMenu ChainProvider and the next provider is tried.
When all providers fail you get a rather upaque message:
PhpcrMenuProvider::has
needs to returnfalse
if the document does not exist, but currently it will returnfalse
if f.e. the document does exist but does not implement theNodeInterface
.It could be taken for granted that if the user has defined the menu base path to be
/cms/menu
then if a document exists at/cmf/menu/foo
then they intended thatfoo
was the menu root.The text was updated successfully, but these errors were encountered: