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

Allow for singular table names when baking fixtures #85

Merged
merged 2 commits into from
May 7, 2015

Conversation

dakota
Copy link
Member

@dakota dakota commented May 7, 2015

Encountered a use case where I am baking fixtures for all my tables. I have a few tables where the table name is singular. This PR adds in the ability to fallback to a singular table if the plural version does not exist.

$data = $schemaCollection->describe($useTable);
try {
$data = $schemaCollection->describe($useTable);
} catch (Exception $e) {
Copy link
Member

Choose a reason for hiding this comment

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

You should catch the specific exception

Copy link
Member Author

Choose a reason for hiding this comment

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

I am. Schema/Collection::describe() throws a Cake\Database\Exception, which is what I'm catching here.

Copy link
Member

Choose a reason for hiding this comment

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

Ah ok

@adayth
Copy link

adayth commented May 7, 2015

I had the same issues with recommended i18n table.

@lorenzo
Copy link
Member

lorenzo commented May 7, 2015

Is it possible to add a test for this?

@dakota
Copy link
Member Author

dakota commented May 7, 2015

Test done :)

@markstory markstory added this to the 1.0.6 milestone May 7, 2015
@markstory
Copy link
Member

Any reason you didn't use the --table option?

@adayth
Copy link

adayth commented May 7, 2015

Maybe he tried to generate fixtures with bake fixtures all and found issue #86

@dakota
Copy link
Member Author

dakota commented May 7, 2015

@markstory, I was running bake fixtures all on order to refresh all fixture files at once.

@markstory
Copy link
Member

Ok, with all you can't really use the option, so trying one other table name makes sense.

markstory added a commit that referenced this pull request May 7, 2015
Allow for singular table names when baking fixtures
@markstory markstory merged commit 21e5df0 into cakephp:master May 7, 2015
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.

4 participants