-
Notifications
You must be signed in to change notification settings - Fork 46
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
Unify common methods #914
Unify common methods #914
Conversation
Revert "rename Model::join to addJoin" This reverts commit b403c55.
0727329
to
1fbf369
Compare
1fbf369
to
a483230
Compare
This reverts commit c789e7e.
8244971
to
6136102
Compare
// handle foreign table containing a dot - that will be reverse join | ||
if (strpos($this->foreign_table, '.') !== false) { | ||
// split by LAST dot in foreign_table name | ||
[$this->foreign_table, $this->foreign_field] = preg_split('~\.+(?=[^.]+$)~', $this->foreign_table); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI foreign_table
table is used as an index when added to a Model, must be set prior init
if (strpos($this->foreign_table, '.') !== false) { | ||
// split by LAST dot in foreign_table name | ||
[$this->foreign_table, $this->foreign_field] = preg_split('~\.+(?=[^.]+$)~', $this->foreign_table); | ||
$this->reverse = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we still overwrite $reverse property while initializing join?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes
return $this->add(Join::fromSeed($this->_default_seed_join, $defaults)); | ||
$join = Join::fromSeed($this->_default_seed_join, $defaults); | ||
|
||
if ($this->hasElement($name = $join->getDesiredName())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we join same table multiple times?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
only one Join can be added which can be retrived by getJoin
, same as for fields and references (even if the setup methods are named hasOne
/hasMany
)
No description provided.