1
0
mirror of synced 2025-01-19 06:51:40 +03:00

Use inflector for add/remove methods

This commit is contained in:
Vladislav Veselinov 2013-02-28 21:05:41 +02:00
parent e5779a0756
commit 30fd22a260

View File

@ -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)) {