-
Notifications
You must be signed in to change notification settings - Fork 66
[WIP] Support initializer priority #173
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
[WIP] Support initializer priority #173
Conversation
@lsmith77 which issue does this relate to? |
@@ -90,4 +97,32 @@ public function initialize() | |||
$initializer->init($this->registry); | |||
} | |||
} | |||
|
|||
|
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.
extra new line
{ | ||
$this->initializers[] = $initializer; | ||
$this->initializers[] = array($initializer, $priority); |
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.
huh? i think you need to remove this line. otherwise you add every initializer twice, once at some undetermined prio starting with 0, and then with the explicit prio.
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.
WIP (tm)
f21c59d
to
4769b27
Compare
@@ -50,8 +50,14 @@ public function process(ContainerBuilder $container) | |||
throw new LogicException(sprintf('initializer "%s" must be public', $id)); | |||
} | |||
|
|||
$priority = 0; |
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.
It seems wrong to define this in two places, i.e. as the default value of the addInitializer
method and here. But the other options I can see are doing an array_call_user_func
or conditionally two versions of the addMethodCall
line below.
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.
given that its all in the same class imho its fine. but if you really wanted to, i guess a class constant could work though IIRC you cannot default to a const, so you would need to default to null and check for it .. imho not worth the trouble.
4769b27
to
6f29b41
Compare
6f29b41
to
2e31ffd
Compare
Updated. Tested with the RoutingAuto tutorial that I started this morning and all is well. |
ca you rebase on master to clean up the travis results? |
ok never mind .. I am testing this and will merge and tag then. |
[WIP] Support initializer priority
This PR was submitted for the dev branch but it was merged into the master branch instead (closes #595). Discussion ---------- [WIP] Tutorial Updates for 1.2 Updates and improvements for 1.2. Note there is a problem in that the RoutingAutoBundle intializes before the initializer that we create in the last chapter, causing it to fail. We need to add support for initializer priority: doctrine/DoctrinePHPCRBundle#173 Commits ------- dc3de60 [WIP] Tutorial Updates for 1.2
Made a start. Unfortunately I don't seem to be able to install the depdenencies and run the tests ..