Generation of Proxies and Hydrators

Showing 1-10 of 10 messages
Generation of Proxies and Hydrators weaverryan 1/19/11 3:32 PM
Hey guys-

Requiring the proxies and hydrators to be generated really kicked my arse last night... and I'm *kinda* smart. I don't think requiring this of all users is realistic, and I think it'll cause a lot of heartache either during development (when they finally switch into the prod environment) or after they deploy. I realize you can change this setting, but user's will only discover this AFTER they've deployed to prod or hit their head against their desk for hours :)

I realize the problem with generating on every request in production, but isn't there a middleground? What about the following (by default):

 * always generate these classes in dev
 * generate conditionally using a file_exists() in prod
 * Keep the option to never generate proxies or hydrators for advanced users (but it has to be explicitly enabled).

Requiring these classes to be generated effectively means that you need to have an automated deployment. That's best practice but just not a reality. Bulat proposed that there could be a check.php or CLI task that checks your app for "production" settings and warns you when things are non-ideal. Perhaps that could be rolled into whatever deployment tools we eventually craft and perfect.

Thoughts?

Ryan Weaver
Lead Programmer - iostudio - Nashville, TN
http://www.iostudio.com
http://www.thatsquality.com
Twitter: @weaverryan
Re: Generation of Proxies and Hydrators Henrik Bjørnskov 1/20/11 2:18 AM
auto_generate_proxy_classes
auto_generate_hydrator_classes
Re: [symfony-devs] Re: Generation of Proxies and Hydrators weaverryan 1/20/11 4:01 AM

Hey henrik-

I'm aware of those options - please read the rest of my post that proposes that the defaults for these options makes the learning curve too great.

Thanks

@weaverryan

On Jan 20, 2011 4:18 AM, "Henrik Bjornskov" <y...@iamhenrik.se> wrote:
> auto_generate_proxy_classes
> auto_generate_hydrator_classes
>
> --
> If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to symfon...@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-devs...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
Re: [symfony-devs] Re: Generation of Proxies and Hydrators Lukas Kahwe Smith 1/20/11 4:04 AM

On 20.01.2011, at 13:01, ryan weaver wrote:

> I'm aware of those options - please read the rest of my post that proposes that the defaults for these options makes the learning curve too great.

I think a check production config command would be a better approach than setting these to on by default.

regards,
Lukas Kahwe Smith
m...@pooteeweet.org

Re: [symfony-devs] Re: Generation of Proxies and Hydrators weaverryan 1/20/11 4:10 AM

I think that still requires too much from a beginner, but if I'm wrong, then the generation of these classes should be documented to be just as central as the build commands in doctrine1 (change your schema, then always rebuild) and it should be off everywhere.

But still, what about the middleground proposal?

@weaverryan

> --
> If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to symfon...@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-devs...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
Re: [symfony-devs] Generation of Proxies and Hydrators Lukas Kahwe Smith 1/20/11 4:13 AM

On 20.01.2011, at 00:32, ryan weaver wrote:

> I realize the problem with generating on every request in production, but isn't there a middleground? What about the following (by default):
>
>  * always generate these classes in dev
>  * generate conditionally using a file_exists() in prod
>  * Keep the option to never generate proxies or hydrators for advanced users (but it has to be explicitly enabled).

that file_exists() is pretty expensive to force upon everyone and adding an if to decide when to do the file_exists() is just ugly imho.

regards,
Lukas Kahwe Smith
m...@pooteeweet.org

Re: [symfony-devs] Generation of Proxies and Hydrators Benjamin Eberlei 1/20/11 4:18 AM
@ryan: This is a Doctrine feature to change, so Symfony couldn't even wrap
around it at the moment. We are changing this slightly for 2.1 to allow 2
additional proxy generation methods:

1. eval
2. stream wrapper + apc cache as discussed here
http://www.whitewashing.de/blog/132

Your suggested file_exists() method is dangerous in case of cache slams
which are rather probable in case of expensive file operations.

greetings,
Benjamin

On Thu, 20 Jan 2011 13:13:11 +0100, Lukas Kahwe Smith <m...@pooteeweet.org>
wrote:

Re: [symfony-devs] Generation of Proxies and Hydrators weaverryan 1/20/11 5:12 AM

Thanks for the good explanation guys. Two things then:

- perhaps we should turn auto-generation off in all environments to be consistent?

- it should be well-documented that the generation tasks be run after every model change so that proxies/hydrators aren't an afterthought

What do you guys think? If you don't generate hydrators, for example, the error is simply a failed require call on a non-existent file in the cache dir. It's not obvious what went wrong or how to fix it. That's really where my concern lies.

Thanks

@weaverryan

> --
> If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony developers" group.
> To post to this group, send email to symfon...@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-devs...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/symfony-devs?hl=en
Re: [symfony-devs] Generation of Proxies and Hydrators Lukas Kahwe Smith 1/20/11 5:22 AM

On 20.01.2011, at 14:12, ryan weaver wrote:

> Thanks for the good explanation guys. Two things then:
>
> - perhaps we should turn auto-generation off in all environments to be consistent?

well its set explicitly to the debug setting. so the setting is there right there for everyone to see in config.yml

> - it should be well-documented that the generation tasks be run after every model change so that proxies/hydrators aren't an afterthought
>
> What do you guys think? If you don't generate hydrators, for example, the error is simply a failed require call on a non-existent file in the cache dir. It's not obvious what went wrong or how to fix it. That's really where my concern lies.

sure documentation is good, check command is better

regards,
Lukas Kahwe Smith
m...@pooteeweet.org

Re: [symfony-devs] Generation of Proxies and Hydrators weaverryan 1/20/11 7:11 AM
I'm just thinking that consistency between the environments is important and, unlike Twig templates, it doesn't seem like hydrators/proxies are generated from code that will be changed very often (you occasionally modify an entity, then rebuilt hydrators/proxies).

On the check command, how could that help unless the check command is able to tell you that your proxies/hydrators are out-of-date and still need to be generated before pushing to production?

Thanks for everyone's feedback.

Ryan Weaver
Lead Programmer - iostudio - Nashville, TN
http://www.iostudio.com
http://www.thatsquality.com
Twitter: @weaverryan


--
If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfon...@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en