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

Three levels relationship #227

Open
zahidmuhammadzaki opened this issue May 22, 2016 · 5 comments
Open

Three levels relationship #227

zahidmuhammadzaki opened this issue May 22, 2016 · 5 comments

Comments

@zahidmuhammadzaki
Copy link

zahidmuhammadzaki commented May 22, 2016

How i can relate 3 models in single call?

Just in case, i have 3 models:

  • Market_model => Market_tree_model => Market_tree_pc_model

Can i call this in 1 call like this?

$this->market_model->with(array(
  'market_tree' => array(
    'with' => market_tree_pc
)))->get_all();
@dadenewyyt
Copy link

I guess you need to chain with the second text on the array like a method
call with the other model.

with()-> ...->with()
On May 23, 2016 2:04 AM, "Zahid" notifications@github.com wrote:

How i can relate 3 models in single call?

Just in case, i have 3 models:

  • Market_model => Market_tree_model => Market_tree_pc_model

Can i call this in 1 call like this?

$this->market_model->with('market_tree' => array(
'with' => market_tree_pc
))->get_all();


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#227

@dadenewyyt
Copy link

simply chain then with remove the arrays
On May 23, 2016 4:53 PM, dadenew.yyt@gmail.com wrote:

I guess you need to chain with the second text on the array like a method
call with the other model.

with()-> ...->with()
On May 23, 2016 2:04 AM, "Zahid" notifications@github.com wrote:

How i can relate 3 models in single call?

Just in case, i have 3 models:

  • Market_model => Market_tree_model => Market_tree_pc_model

Can i call this in 1 call like this?

$this->market_model->with('market_tree' => array(
'with' => market_tree_pc
))->get_all();


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#227

@zahidmuhammadzaki
Copy link
Author

@dadenewyyt

Do you mean like this?
$this->market_model->with('market_tree')->with('market_tree_pc')->get_all();

But, it only works if

market_model (has many) => market_tree;
and
market_model (has many) => market_tree_pc;

What i mean is
market_model (has many) => market_tree (has_many) => market_tree_pc

and i want call tree of this in single call like below,
$this->market_model->with(array( 'market_tree' => array( 'with' => market_tree_pc )))->get_all();

@dadenewyyt
Copy link

Yes Zakir. To use the my Model you have to follow the rules With take a has
many or one to one relationship to refer as with. So if you want to give a
new meaning to with - you should modify it in my_model class = may be a new
name with_new .

On Tue, May 24, 2016 at 11:48 AM, Zahid notifications@github.com wrote:

@dadenewyyt https://github.com/dadenewyyt

Do you mean like this?

$this->market_model->with('market_tree')->with('market_tree_pc')->get_all();

But, it only works if

market_model (has many) => market_tree;

and

market_model (has many) => market_tree_pc;

What i mean is

market_model (has many) => market_tree (has_many) => market_tree_pc

and i want call tree of this in single call like below,

$this->market_model->with(array(
'market_tree' => array(
'with' => market_tree_pc
)))->get_all();


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#227 (comment)

Daniel Adenew
YYT Software Development
www.yytsoftware.com

@zahidmuhammadzaki
Copy link
Author

My name is zahid :D

I see.
But i hope it can be the new feature in the new update..

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

No branches or pull requests

2 participants