-
-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Labels
Description
Description
Singularized form of adder/remover method name for collections is hardcoded to the first item from the list returned by EnglishInflector:
schema-generator/src/Model/Class_.php
Line 335 in ed297c7
return $inflector->singularize($string)[0]; |
If transformation is ambiguous inflector return list of proposition, and in some cases first one it not we want to, for example:
$ php -r 'require "vendor/autoload.php"; echo (new Symfony\Component\String\Inflector\EnglishInflector())->singularize("languages")[0].PHP_EOL;'
languag
How to reproduce
types:
Book:
properties:
languages:
cardinality: "(1..*)"
range: Language
gives:
class Book
(...)
function addLanguag(Language $languag)
(...)
Possible Solution
- ability to use alternate inflector class (in.e., decoration of EnglishInflector)
- give singular form of given property in explicit by additional config paramater