Merge pull request #594 from v3labs/master
Use inflector in EntityGenerator
This commit is contained in:
commit
2372a85d9f
@ -1092,8 +1092,8 @@ public function __construct()
|
|||||||
protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null)
|
protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $fieldName, $typeHint = null, $defaultValue = null)
|
||||||
{
|
{
|
||||||
$methodName = $type . Inflector::classify($fieldName);
|
$methodName = $type . Inflector::classify($fieldName);
|
||||||
if (in_array($type, array("add", "remove")) && substr($methodName, -1) == "s") {
|
if (in_array($type, array("add", "remove"))) {
|
||||||
$methodName = substr($methodName, 0, -1);
|
$methodName = Inflector::singularize($methodName);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->hasMethod($methodName, $metadata)) {
|
if ($this->hasMethod($methodName, $metadata)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user