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

Add a usable join array model interface. #91

Closed
romaninsh opened this issue Aug 13, 2016 · 0 comments
Closed

Add a usable join array model interface. #91

romaninsh opened this issue Aug 13, 2016 · 0 comments

Comments

@romaninsh
Copy link
Member

In my example I have table "Nominal" which is hierarchical. When I load it, I create an array like this:

"id" -> "path"

This is handy for be because now that when I'm reading from another model and it contain "id" value, I can look up full nominal path without worrying about number of selects.

I believe Agile Data can do this for me special join type. Here is how I'd like it to work:

$n = new Model_Nominal($db);
$assoc = $n->getPathAssociations();  // returns "id" -> "path"

// Next create a model
$nar = new Model($assoc));

// Test it
$nar->load(183);
echo $nar[$nar->title_field];  // will output path

$m = new Model_Report_Activity($db);
$m->join($nar, 'nominal_id')->addField('nominal_path');

foreach($m as $row) {
    var_dump($row); // includes 'nominal_path' now
}
@romaninsh romaninsh added this to the 1.1.0 milestone Aug 15, 2016
@romaninsh romaninsh modified the milestones: 1.2.0, 1.1.0 Aug 28, 2016
@mvorisek mvorisek removed this from the 1.2.0 milestone Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants