-
-
Notifications
You must be signed in to change notification settings - Fork 509
Add support for alternate Hydrator generation methods #953
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
Conversation
AUTOGENERATE_FILE_NOT_EXISTS and AUTOGENERATE_EVAL.
const AUTOGENERATE_FILE_NOT_EXISTS = 2; | ||
|
||
/** | ||
* Generate the proxy classes using eval(). |
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.
Should be "proxy/hydrator" instead of "proxy"?
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.
Oops, yes, I missed that one.
👍 I'll need this in upcoming week :) |
Thanks. Yeah, I'm running in EVAL mode now - it's great. On 10/03/2014 11:43 AM, Maciej Malarz wrote:
Kevin Perry |
+1 |
@@ -137,10 +138,27 @@ public function getHydratorFor($className) | |||
|
|||
if ( ! class_exists($fqn, false)) { | |||
$fileName = $this->hydratorDir . DIRECTORY_SEPARATOR . $hydratorClassName . '.php'; | |||
if ($this->autoGenerate) { | |||
$this->generateHydratorClass($class, $hydratorClassName, $fileName); | |||
switch ($this->autoGenerate) { |
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.
This property needs to be updated now that it is no longer a boolean.
Here:
and here:
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.
Good point. Done.
Late to the party here, but if we end up adopting Common's proxy generator down the line, will this port over nicely? I don't recall if we had an outstanding TODO ticket for that, but I seem to recall talking about it with @Ocramius last year. |
This implements two new auto-gen modes for hydrators: AUTOGENERATE_FILE_NOT_EXISTS and AUTOGENERATE_EVAL, per our discussion labelled issue #889.
When I dug into the code, I discovered that \Doctrine\Common\Proxy\AbstractProxyFactory already implemented exactly the same algorithms that I wanted for Hydrators, even including eval() mode. So I've closely patterned my HydratoryFactory mods after the code in AbstractProxyGenerator. I also put the constant definitions for the different auto-gen modes into the Configuration class, for easy reference.