# |
Apr 19th 2017, 13:08 |
crazycoder |
but _joinData still here |
# |
Apr 19th 2017, 13:07 |
crazycoder |
i used .name |
# |
Apr 19th 2017, 13:07 |
crazycoder |
select() ? nah |
# |
Apr 19th 2017, 13:07 |
inoas |
then you can switch $hidden based on that |
# |
Apr 19th 2017, 13:07 |
inoas |
maybe through select ;) |
# |
Apr 19th 2017, 13:07 |
inoas |
[[your_flag]] |
# |
Apr 19th 2017, 13:07 |
inoas |
maybe you can find a way to pass down a flag to your entity |
# |
Apr 19th 2017, 13:06 |
inoas |
I found it always troubling that there are two ways to do it and if formatResults or $_hidden would be better |
# |
Apr 19th 2017, 13:06 |
inoas |
you can work with formatResults |
# |
Apr 19th 2017, 13:06 |
inoas |
yes |
# |
Apr 19th 2017, 13:06 |
crazycoder |
ok thanks inoas |
# |
Apr 19th 2017, 13:05 |
crazycoder |
hmm i think formatResults is better in that case |
# |
Apr 19th 2017, 13:05 |
crazycoder |
yes i need to foreach it |
# |
Apr 19th 2017, 13:05 |
inoas |
one of those walks through resultset for sure |
# |
Apr 19th 2017, 13:05 |
inoas |
collection, foreach, ArrayIterator |
# |
Apr 19th 2017, 13:04 |
inoas |
I really really need to get back to work, I am sure you can manage ;) |
# |
Apr 19th 2017, 13:04 |
inoas |
it is a resultset of entities (and nested entities) |
# |
Apr 19th 2017, 13:04 |
inoas |
you need to iterate it |
# |
Apr 19th 2017, 13:04 |
inoas |
debug $result ;p |
# |
Apr 19th 2017, 13:04 |
inoas |
please do your homework yourself ;) |
# |
Apr 19th 2017, 13:04 |
crazycoder |
that way? |
# |
Apr 19th 2017, 13:04 |
crazycoder |
$result->setHIdden(...) |
# |
Apr 19th 2017, 13:04 |
crazycoder |
$result = $query->all() |
# |
Apr 19th 2017, 13:04 |
inoas |
->first() ->all() |
# |
Apr 19th 2017, 13:04 |
inoas |
you can fetch it first |
# |
Apr 19th 2017, 13:04 |
inoas |
so whats the question? |
# |
Apr 19th 2017, 13:03 |
crazycoder |
i do the query then _serialize |
# |
Apr 19th 2017, 13:03 |
crazycoder |
inoas, yes |
# |
Apr 19th 2017, 13:03 |
inoas |
crazycoder: you use it in your controller probably |
# |
Apr 19th 2017, 13:02 |
crazycoder |
but how can i use it after the query |
# |
Apr 19th 2017, 13:02 |
crazycoder |
it exists |
# |
Apr 19th 2017, 13:02 |
crazycoder |
https://api.cakephp.org/3.4/class-Cake.Datasource.EntityTrait.html#_setHidden |
# |
Apr 19th 2017, 13:01 |
crazycoder |
inoas, wait ... does cake will call that method automatically? |
# |
Apr 19th 2017, 13:00 |
inoas |
if it doesn't work you can always create that method in your entity |
# |
Apr 19th 2017, 13:00 |
inoas |
try $entity->setHidden( |
# |
Apr 19th 2017, 13:00 |
inoas |
well if that works, there you go |
# |
Apr 19th 2017, 13:00 |
crazycoder |
inoas, can i do it on the fly? i mean i would like to hide it only during a json call |
# |
Apr 19th 2017, 13:00 |
crazycoder |
in protected $_hidden = ['_joinData'] |
# |
Apr 19th 2017, 12:59 |
crazycoder |
inoas, yes |
# |
Apr 19th 2017, 12:57 |
inoas |
back to work |
# |
Apr 19th 2017, 12:57 |
inoas |
and you are hiding? _joinData? |