Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no documented way of clearing a route's default/option/requirements #20296

Closed
joachim-n opened this issue Oct 25, 2016 · 5 comments

Comments

Projects
None yet
4 participants
@joachim-n
Copy link

commented Oct 25, 2016

I have a route object that a base class defines, and I want to remove an attribute from it, either a default, an option, or a requirement.

What seems to work is setDefault('propertyname', NULL), but that doesn't seem to be documented.

@Tobion

This comment has been minimized.

Copy link
Member

commented Oct 26, 2016

What do you expect as solution of this issue?

@joachim-n

This comment has been minimized.

Copy link
Author

commented Oct 26, 2016

Well I suppose one of:

a) there is a way to clear a requirement (either NULL, or something else I'm not aware of). The docs should be fixed to mention this.
b) there is no correct way to clear a requirement, but using NULL works to clear a requirement, but it's an unintended effect. This should be adopted and documented.
c) there is no correct way to clear a requirement; using NULL works but should not be relied upon. This is a missing feature.

@javiereguiluz

This comment has been minimized.

Copy link
Member

commented Oct 24, 2017

@joachim-n I've tested your code and it doesn't work for me:

$route->getOption('foo');       // 'bar'
$route->hasOption('foo'));      // true
$route->setOption('foo', null);
$route->hasOption('foo'));      // true
$route->getOption('foo');       // null

It's a bit cumbersome, but you could do this to remove some options:

->setOptions(array_diff($route->getOptions, ['foo']));

My only question would be: is this feature something needed that should be implemented ... or is it an edge-case and we can ignore it? Thanks!

@fabpot

This comment has been minimized.

Copy link
Member

commented Feb 20, 2018

Closing as there is no more feedback here.

@fabpot fabpot closed this Feb 20, 2018

@joachim-n

This comment has been minimized.

Copy link
Author

commented Feb 20, 2018

My only question would be: is this feature something needed that should be implemented ... or is it an edge-case and we can ignore it? Thanks!

Surely that question was address to maintainers, rather than to myself?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.