cycle/orm

💡 Allow setting enum cases as property defaults

rauanmayemir opened this issue · 0 comments

I have an idea!

Currently, entity column attribute declaration can look like this:

new Cycle\Column(type: 'tinyInteger', property: 'event_type', default: EventType::CREATED->value, typecast: EventType::class),

I.e we can only use scalar values like EventType::CREATED->value as default.

Proposed improvement suggestion is to allow using enum cases without converting to underlying scalar value like so:

new Cycle\Column(type: 'tinyInteger', property: 'event_type', default: EventType::CREATED, typecast: EventType::class),