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

Updating model builder to build proper syntax for foreign key #123

Merged
merged 1 commit into from
Oct 16, 2013
Merged

Updating model builder to build proper syntax for foreign key #123

merged 1 commit into from
Oct 16, 2013

Conversation

MatejBalantic
Copy link
Contributor

As noted in those two issues:
#47
http://forum.phalconphp.com/discussion/436/generate-model-error-with-addforeignkey-method

model generator currently builds foreign key syntax like that:
$this->belongsTo("id", "Objects", "id");
$this->addForeignKey("id", "Objects", "id");

However, based on documentation of latest phalcon:
http://docs.phalconphp.com/en/latest/reference/models.html#virtual-foreign-keys

it should have been like that:
$this->belongsTo("owner_id", "Objects", "id", array(
'foreignKey' => true
));

I updated the builder to support the new syntax. The update is done in a way that supports additional options in future.

@MatejBalantic MatejBalantic mentioned this pull request Oct 16, 2013
phalcon pushed a commit that referenced this pull request Oct 16, 2013
Updating model builder to build proper syntax for foreign key
@phalcon phalcon merged commit df51e81 into phalcon:master Oct 16, 2013
@phalcon
Copy link
Collaborator

phalcon commented Oct 16, 2013

thanks!

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.

None yet

2 participants