# |
Apr 19th 2017, 12:43 |
inoas |
and work from there |
# |
Apr 19th 2017, 12:43 |
inoas |
and a blank users model without plugin maybe even |
# |
Apr 19th 2017, 12:43 |
inoas |
start with nothing ;p |
# |
Apr 19th 2017, 12:43 |
Junior |
my user model is AuthAcl.Users |
# |
Apr 19th 2017, 12:42 |
Junior |
inoas, no, found it somewhere in the docs to load that way |
# |
Apr 19th 2017, 12:42 |
inoas |
belongsToMany is just a shortcut around hasMany <> belongs to JOIN MODEL belongs to <> hasMany other Model |
# |
Apr 19th 2017, 12:41 |
inoas |
hasMany |
# |
Apr 19th 2017, 12:41 |
inoas |
then make it so |
# |
Apr 19th 2017, 12:39 |
crazycoder |
Agents is not associated with AgentsSectors |
# |
Apr 19th 2017, 12:38 |
inoas |
is that your users model? |
# |
Apr 19th 2017, 12:38 |
inoas |
Junior: why do you have a model named Footprints? |
# |
Apr 19th 2017, 12:38 |
inoas |
and then within that contain Sectors |
# |
Apr 19th 2017, 12:38 |
inoas |
Agents.AgentsSectors = use select here to only specify agent_id and sector id |
# |
Apr 19th 2017, 12:38 |
inoas |
try going through the auto join model |
# |
Apr 19th 2017, 12:37 |
crazycoder |
Agents->find()->contain(the previos code) |
# |
Apr 19th 2017, 12:37 |
crazycoder |
it is a hbtm relationship |
# |
Apr 19th 2017, 12:36 |
inoas |
how does your finder look |
# |
Apr 19th 2017, 12:36 |
crazycoder |
}, |
# |
Apr 19th 2017, 12:36 |
crazycoder |
return $q->select(['Sectors.name']); |
# |
Apr 19th 2017, 12:36 |
crazycoder |
'Agents.Sectors' => function($q) { |
# |
Apr 19th 2017, 12:36 |
crazycoder |
yeah i do that |
# |
Apr 19th 2017, 12:36 |
Junior |
user |
# |
Apr 19th 2017, 12:36 |
Junior |
inoas, if i remove from my code $this->loadModel('Footprints'); i no longer get the auto-tables error but i get an empty iser |
# |
Apr 19th 2017, 12:36 |
inoas |
that's weirdo |
# |
Apr 19th 2017, 12:36 |
crazycoder |
i only need the name |
# |
Apr 19th 2017, 12:36 |
crazycoder |
inoas, this is a piece of output right now https://gist.github.com/anonymous/a4fd71a376a5e47ecf54d5bd9d51f853 |
# |
Apr 19th 2017, 12:35 |
inoas |
you can remove fields with entity or ->select() within contain then |
# |
Apr 19th 2017, 12:35 |
inoas |
public function findWithCourses(Query $query, $options) { return $query->contain('Memberships')->contain('Memberships.Courses'); } |
# |
Apr 19th 2017, 12:35 |
crazycoder |
(in AgentsTable) |
# |
Apr 19th 2017, 12:35 |
crazycoder |
inoas, https://gist.github.com/anonymous/73969757e70940051b22499330f44b61 this for example |
# |
Apr 19th 2017, 12:34 |
inoas |
you can use formatResults ;p |
# |
Apr 19th 2017, 12:34 |
inoas |
anyway |
# |
Apr 19th 2017, 12:34 |
inoas |
and then my 95% bet is that $_hidden can hide those real model information |
# |
Apr 19th 2017, 12:34 |
inoas |
then create a real model and use through |
# |
Apr 19th 2017, 12:33 |
inoas |
if you are using _joinData for anything relevant |
# |
Apr 19th 2017, 12:33 |
crazycoder |
inoas, why ? |
# |
Apr 19th 2017, 12:33 |
inoas |
yeah but it is IMHO designed wrong |
# |
Apr 19th 2017, 12:33 |
inoas |
then in the Memberships Entity use $_hidden |
# |
Apr 19th 2017, 12:33 |
crazycoder |
it is only the output format that i should hack |
# |
Apr 19th 2017, 12:33 |
inoas |
Memberships belongsTo Students / Memberships belongsTo Courses |
# |
Apr 19th 2017, 12:33 |
crazycoder |
yeah but the association is working correctly |