We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Assume the following tables: minisites { id campaign_id title }
campaigns { id title }
Assume a declared the NotORM_Structure_Convention: $structure = new NotORM_Structure_Convention("id","%s_id","%ss");
NotORM still can't get it right, or am I missing something?
$_minisites = $nORM->minisites($criteria); foreach ($_minisites as $m) { print $m['title'].'|'; print $m->campaigns['title'].'|'; // wrong, print $m->campaign['title'].':'; // wrong, } // NOTORM try to access the campaigns_id which is wrong
Any ideas how to make it work?
The text was updated successfully, but these errors were encountered:
OK, 2 things need be done here:
Here how I solved it: $res = $_minisites->select('minisites.id, minisites.title, campaigns.title')->fetch();
And override the Structure class:
class My_NotORM_Conversion extends NotORM_Structure_Convention { function __construct() { $this->primary = 'id'; $this->foreign = '%s_id'; $this->table = '%s'; } function getReferencedColumn($name, $table) { if ($this->table != '%s' && preg_match('(^' . str_replace('%s', '(.*)', preg_quote($this->table)) . '$)', $name, $match)) { $name = $match[1]; } $inflector = new Inflect(); $name = $inflector->singularize($name); return sprintf($this->foreign, $name, $table); } }
will be waiting for official solution.
Sorry, something went wrong.
$m->campaign['title'] works for me with your database structure and your $structure.
$m->campaign['title']
$structure
No branches or pull requests
Assume the following tables:
minisites {
id
campaign_id
title
}
Assume a declared the NotORM_Structure_Convention:
$structure = new NotORM_Structure_Convention("id","%s_id","%ss");
NotORM still can't get it right, or am I missing something?
Any ideas how to make it work?
The text was updated successfully, but these errors were encountered: