# |
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 |
# |
Apr 19th 2017, 12:32 |
inoas |
Students HasMany Memberships |
# |
Apr 19th 2017, 12:32 |
inoas |
Students belongsToMany Courses Through Memberships |
# |
Apr 19th 2017, 12:32 |
crazycoder |
i only want the tag name without this extra info |
# |
Apr 19th 2017, 12:32 |
crazycoder |
basically i have Users -> Tags (UsersTags) |
# |
Apr 19th 2017, 12:32 |
inoas |
use belongsToMany and through + hasMany/belongsTo |
# |
Apr 19th 2017, 12:32 |
inoas |
if you have more than foreign keys in there |
# |
Apr 19th 2017, 12:31 |
inoas |
joinData is imho a hack |
# |
Apr 19th 2017, 12:31 |
crazycoder |
the query is working i only should avoid showing "_joinData" there |
# |
Apr 19th 2017, 12:31 |
inoas |
maybe that works + hidden then |
# |
Apr 19th 2017, 12:31 |
inoas |
if it doesnt setup a real join model and use setThrough on the assoc |
# |
Apr 19th 2017, 12:31 |
inoas |
however not sure if joinData is a real/has a real entity |
# |
Apr 19th 2017, 12:30 |
inoas |
on the entity |
# |
Apr 19th 2017, 12:30 |
crazycoder |
thanks! |
# |
Apr 19th 2017, 12:30 |
crazycoder |
ok |
# |
Apr 19th 2017, 12:30 |
crazycoder |
it is a json response |
# |
Apr 19th 2017, 12:30 |
inoas |
so see $_hidden |
# |
Apr 19th 2017, 12:30 |
crazycoder |
i am building api |
# |
Apr 19th 2017, 12:30 |
crazycoder |
inoas, yes exactly |
# |
Apr 19th 2017, 12:30 |
inoas |
right? |
# |
Apr 19th 2017, 12:30 |
inoas |
because it is json, or soemthing |
# |
Apr 19th 2017, 12:30 |
crazycoder |
what setting should i have to pass? |
# |
Apr 19th 2017, 12:30 |
inoas |
crazycoder: why do you want to remove stuff from the response? |