Skip to content

CRUD generator strips underscores from properties #6493

Closed
maerten opened this Issue Dec 27, 2012 · 3 comments

2 participants

@maerten
maerten commented Dec 27, 2012

The CRUD generator (v 2.1.7-dev) strips underscores from propertynames in the generated templates:

// anotations etc
class MyEntity {
// anotations etc
private $my_property_with_underscores;

}

gets converted to this template

{{ entity.mypropertywithunderscores }}

Although it was pointed out on IRC that using underscores is not in line with the style conventions, it's unnecessary to strip underscores from property names, as a propertynames are safe for template anyway.

@stof
Symfony member
stof commented Dec 27, 2012

Twig does not use the private property (it cannot as it is private). It uses the getter. And the generated getter will not contain underscores IIRC

@maerten
maerten commented Dec 27, 2012

You're right about that.
The problem still exists though; I'm using the __get() / __set() / __isset() methods on my Entities for easier maintenance. So the properties will be accessed by their real names (with underscores).

The templates work fine if I insert the underscores back in.

@stof
Symfony member
stof commented Dec 27, 2012

anyway, this should be reported to SensioGeneratorBundle as the crud generator is not part of Symfony itself.

@stof stof closed this Dec 27, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.