Fix casing of validation rules in bake #1656

Merged
merged 1 commit into from Sep 18, 2013

Conversation

Projects
None yet
4 participants
Member

dereuromark commented Sep 18, 2013

This has been bothering me for a quite a while now.. I always had to manually rename the baked validation rules, as they did not match the actual method names.

Bake would simply lowercase all validation rules, and while this works due to PHP case insensitivity, this gets quite messy/unreadable at some point

'content' => array(
        'notempty' => array(
            'rule' => array('notempty'),
            ...
        ),
    ),

Same for maxLength, inList, ...
It is also a good practice to always name your called rules the same than their actual name.
Or bad casings like nOtEmpTY etc would also be valid and acceptable here :)

This bug-fix resolves this unnecessary lower-casing:

'content' => array(
        'notEmpty' => array(
            'rule' => array('notEmpty'),
            ...
        ),
    ),
Member

josegonzalez commented Sep 18, 2013

👍

Member

ravage84 commented Sep 18, 2013

Cool 👍

markstory added a commit that referenced this pull request Sep 18, 2013

@markstory markstory merged commit e690c93 into cakephp:master Sep 18, 2013

1 check passed

default The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment