This topic contains 2 replies, has 2 voices, and was last updated by Dima Soroka 9 years, 7 months ago.
- Topic
Hi guys.
I’m working at custom entities APIs implementation & faced with the problem: if using provided by bundle methods to build Get response – not all fields are returned. After a small research I’ve figured out, that fields with “underscored” names are skipped. See the code that manages this logic:
123456789101112$accessors = array('get' . ucfirst($field), 'is' . ucfirst($field), 'has' . ucfirst($field));foreach ($accessors as $accessor) {if (method_exists($entity, $accessor)) {$value = $entity->$accessor();$this->transformEntityField($field, $value);$result[$field] = $value;break;}}I guess, this is done to handle the relations properly.
Had a look at system entities, I’ve decided, that the ORO logic is that Entities field names should be “camelCased” to be managed correctly by the platform.
But Custom entity field name is restricted to be only lowercased. Found where this is defined https://github.com/orocrm/platform/blob/master/src/Oro/Bundle/EntityExtendBundle/Resources/config/validation.yml#L12:
1234567fieldName:- NotBlank: ~- Regex:pattern: "/^[a-z]+[a-z0-9_]*$/"message: This value should contains only lower alphabetic symbols, underscore and numbersSo, my question is: why the Upper case is not allowed for custom entity field name? Can you allow camelCase for custom entity field name?
The forum ‘OroPlatform – Programming Questions’ is closed to new topics and replies.