News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Micheal Kimsal's Blog:
Symfony __toString() generation
August 20, 2008 @ 11:14:50

Michael Kimsal has pointed out a small irritation when using the Symfony framework and models - an issue when using models that have relationships.

If there are relations (an Author has a Book, for example). the generated forms will complain that the generated Models need a __toString() method to be used in the Form/View. In grails, this is the case, but every domain (corresponding to a Symfony 'model') has an implicit toString() method already generated, which return the string ":". For most production work, you'll want to override it with whatever you need the string to read, but for prototyping, it's fine.

He went in and modified the Symfony core to add in a __toString call that would return the object correctly. Several of the commentors agree with his frustration and some of the Symfony developers even chime in with some of the reasoning behind why it's like that.

0 comments voice your opinion now!
symfony tostring generation model issue join


blog comments powered by Disqus

Similar Posts

Fabian's Blog: Better Performance patch for Symfony 1.0.x and Propel 1.2

Lukas Smith: __toString() or not __toString()?

Dikini.net: Rewriting macros - the peculiar case of php

Matthias Noback: Symfony2: Framework independent controllers parts 2 & 3

Marco Tabini's Blog: WordPress, the GPL and cherries on top


Community Events

Don't see your event here?
Let us know!


library laravel voicesoftheelephpant release opinion unittest api extension threedevsandamaybe symfony framework series community introduction version interview security podcast laravel5 language

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework