Skip to content

4.0.1

Compare
Choose a tag to compare
@dereuromark dereuromark released this 24 Dec 15:39
· 26 commits to master since this release

Fixed

Fixed role reading/detection for role as backed enum.

The following would now work for a string field:

namespace App\Model\Enum;

use Cake\Database\Type\EnumLabelInterface;
use Cake\Utility\Inflector;

enum UserRole: string implements EnumLabelInterface {

    case MAINTAINER = 'maintainer';
    case ADMIN = 'admin';

    /**
     * @return string
     */
    public function label(): string {
        return Inflector::humanize(mb_strtolower($this->name));
    }

}