Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete fails unless I remove checkRules on delete #65

Closed
johneady opened this issue Dec 14, 2024 · 1 comment
Closed

Delete fails unless I remove checkRules on delete #65

johneady opened this issue Dec 14, 2024 · 1 comment
Assignees

Comments

@johneady
Copy link

Hi folks, when I use the plugin using the const strategy.

const STATUS_PUBLIC = 'Published'; const STATUS_DRAFT = 'Drafted'; const STATUS_ARCHIVE = 'Archived';

$this->addBehavior('CakeDC/Enum.Enum', ['lists' => [ 'status_ind' => [ 'strategy' => 'const', 'prefix' => 'STATUS' ] ]]);

everything works perfectly for insert and update. But when I try to delete an entity that has an enum, validation occurs and fails with the following message

array_key_exists(): Argument #1 ($key) must be a valid array offset type

when I bypass validation.

$this->Users->delete($user, ['checkRules' => false])

then everything works. Is this the intended behavior or am I missing something? I've tried this on the latest 5.1.1 of cake as well as the latest version of this plugin.

@johneady johneady changed the title Delete fails unless I remove checkRules on delete for const strategy Delete fails unless I remove checkRules on delete Dec 14, 2024
@arusinowski arusinowski self-assigned this Jan 4, 2025
@arusinowski
Copy link
Member

Thank you for reportng this issue, it is fixed in the new release https://github.com/CakeDC/Enum/releases/tag/3.2.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants