Skip to content

Conversation

@dereuromark
Copy link
Member

Refs cakephp/cakephp#18024

for a quick fix in docs to be in sync with the other example already on that page further up:

To use this type you need to specify which column is associated to which BackedEnum inside the table class::

    use \Cake\Database\Type\EnumType;
    use \App\Model\Enum\ArticleStatus;

    // in src/Model/Table/ArticlesTable.php
    public function initialize(array $config): void
    {
        $this->getSchema()->setColumnType('status', EnumType::from(ArticleStatus::class));
    }

@dereuromark dereuromark added this to the 5.x milestone Nov 18, 2024
@markstory markstory merged commit a3a27b1 into 5.x Nov 18, 2024
3 checks passed
@markstory markstory deleted the 5.x-schema-type-fix branch November 18, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants