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

Fix to Issue #46 - Factory.php attempting to create relationship for fields with {$class}_id #59

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

GrandadEvans
Copy link

Factory.php was not taking into account fields that have {$class}_id as their primary key instead of id eg user_id as the primary key for the users table. - fixed and tests still pass.

All existing test passing but sorry - I'm only half way into "Laravel Testing Decoded" so not confident enough to write additional test as I get to the
if (static::$isSaving and preg_match('/([A-z]+)[-_]id$/i', $field, $matches))
line (c. 330) and I'm not sure you want to set the $isSaving to true & start saving to a db.

Factory.php was not taking into account fields that have `{$class}_id` as their primary key instead of `id` eg `user_id` as the primary key for the `users` table. - fixed and tests still pass
Put my info in the composer.json so that I can submit the package to packagist and pull it in with the fixed file instead of my changes being undone when composer updates.
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.

1 participant