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

When setting options as a non-associative array, Column fails with "Call to undefined method Phinx\Db\Table\Column::set0()" #908

Merged
merged 1 commit into from
Jul 25, 2016

Conversation

f3ath
Copy link
Contributor

@f3ath f3ath commented Jul 19, 2016

This check makes sure the developer gets an appropriate message.

@rquadling
Copy link
Collaborator

Should the Index and ForeignKey also have the same guarding?

…all to undefined method Phinx\Db\Table\Column::set0()". This check makes sure the developer gets an appropriate message.

Using strict in_array() to check for non-assoc arrays
if (!in_array($option, $validOptions)) {
throw new \RuntimeException('\'' . $option . '\' is not a valid foreign key option.');
if (!in_array($option, $validOptions, true)) {
throw new \RuntimeException(sprintf('"%s" is not a valid foreign key option.', $option));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unified the exception messages

@f3ath
Copy link
Contributor Author

f3ath commented Jul 25, 2016

@rquadling done, with a cleaner solution

@rquadling rquadling merged commit 7850120 into cakephp:0.6.x-dev Jul 25, 2016
@rquadling
Copy link
Collaborator

Excellent work. Thank you.

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

Successfully merging this pull request may close these issues.

2 participants