This is interesting. I’ll look at it in more depth tonight. Thanks!

 

From: Marco Pivetta [mailto:[email protected]] 
Sent: Friday, July 15, 2011 11:27 AM
To: Kyle Spraggs
Cc: Andreas Möller; [email protected]
Subject: Re: [fw-general] Zend Framework, Doctrine 2 - Let's talk entities
and forms

 

I implemented something similar, but in an ugly way (really similar to
procedural style, but I had to do it quick 'n dirty)...
Just take a look at this:

https://gist.github.com/1084994

The code you should look for goes from line 72 to 238... Ignore the ACL
stuff...
The rest is almost completely dirt (also consider that I had to play around
with it lots of times, running behind the requests of a crazy customer :P )

That big switch is probably a trouble, but I think you could use some
annotation class for form elements too...
You could have a field annotation that can generate a form element once you
invoke it, like:

$annotation = new \Spiffy\Annotation\FormElement\Textarea($options); //This
happens internally, in the annotationReader, therefore it will be fetched
from there...

$myFormElement = $annotation->createElement(stdClass $entity, $em,
$annotationReader); //form element with all needed validators and similars
coming from annotations...

Could this work for you?

Marco Pivetta
http://twitter.com/Ocramius
http://marco-pivetta.com




On 15 July 2011 18:07, Kyle Spraggs <[email protected]> wrote:

I'm open to suggestions if you have them. Specifically on how to handle the
form elements better as they're a foreign subject for me currently.


-----Original Message-----
From: Andreas Möller [mailto:[email protected]]
Sent: Friday, July 15, 2011 11:06 AM
To: SpiffyJr
Cc: [email protected]
Subject: Re: [fw-general] Zend Framework, Doctrine 2 - Let's talk entities
and forms

Nice one!


I have been thinking about this as it would just make sense!


Best regards,

Andreas


--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]



 

Reply via email to