# |
Mar 6th 2018, 15:41 |
Es0teric |
it is |
# |
Mar 6th 2018, 15:38 |
jeremyharris |
esoteric ok, that’s just a refactoring of your searchByEmail method. the app breaking is not a result of that |
# |
Mar 6th 2018, 15:37 |
flavius |
app crashes because you arent supposed to overwrite `__construct` like that |
# |
Mar 6th 2018, 15:37 |
flavius |
at least call parent::__construct as well :)) |
# |
Mar 6th 2018, 15:37 |
Es0teric |
for some reason |
# |
Mar 6th 2018, 15:37 |
Es0teric |
i want it to be like that but the app crashes |
# |
Mar 6th 2018, 15:37 |
jeremyharris |
or overload the constructor correctly |
# |
Mar 6th 2018, 15:37 |
Es0teric |
jeremyharris https://kopy.io/zP8VA |
# |
Mar 6th 2018, 15:36 |
flavius |
the one that suits you |
# |
Mar 6th 2018, 15:36 |
flavius |
you shouldn't do that, use one of the life cycle callbacks |
# |
Mar 6th 2018, 15:36 |
flavius |
i think because you are overwriting __construct it breaks your app |
# |
Mar 6th 2018, 15:36 |
jeremyharris |
(I think you should fix your controller like @flavius is suggesting though, it might be your actual problem) |
# |
Mar 6th 2018, 15:36 |
Es0teric |
the problem is that i want it to be like this |
# |
Mar 6th 2018, 15:36 |
jeremyharris |
ok so it’s returning an array. what’s the problem, what to do with that array? |
# |
Mar 6th 2018, 15:35 |
Es0teric |
thats the debug() |
# |
Mar 6th 2018, 15:35 |
Es0teric |
jeremyharris https://kopy.io/3wna8 |
# |
Mar 6th 2018, 15:35 |
flavius |
https://book.cakephp.org/2.0/en/controllers.html#request-life-cycle-callbacks |
# |
Mar 6th 2018, 15:35 |
jeremyharris |
still what? do you at least see the array? |
# |
Mar 6th 2018, 15:34 |
Es0teric |
jeremyharris still.. |
# |
Mar 6th 2018, 15:34 |
jeremyharris |
yeah the constructor breaks the controller too, you’re right @flavius |
# |
Mar 6th 2018, 15:34 |
jeremyharris |
sorry my brain is fried today. try `debug();die` |
# |
Mar 6th 2018, 15:34 |
flavius |
i dont think you should be using `public function __construct()` try beforeFilter or any other special cake functions built in |
# |
Mar 6th 2018, 15:33 |
jeremyharris |
`\dd()` maybe you don’t have it, I just noticed it’s cake 2 |
# |
Mar 6th 2018, 15:33 |
Es0teric |
this app is so fucked man... i cant use dd() because its not in the proper namespace... wtf |
# |
Mar 6th 2018, 15:32 |
jeremyharris |
k try debugging. also, the constructor runs the method but doesn’t do anything with the results, is that correct? |
# |
Mar 6th 2018, 15:32 |
Es0teric |
sorry |
# |
Mar 6th 2018, 15:32 |
Es0teric |
jeremyharris i mean this https://kopy.io/shlHV |
# |
Mar 6th 2018, 15:32 |
jeremyharris |
what if you put a `dd($society_list)` right above the return |
# |
Mar 6th 2018, 15:31 |
jeremyharris |
err nm |
# |
Mar 6th 2018, 15:31 |
jeremyharris |
it could be skipping the loop and returning an uninitialized var |
# |
Mar 6th 2018, 15:31 |
jeremyharris |
do you define $society_list before the loop? |
# |
Mar 6th 2018, 15:30 |
Es0teric |
jeremyharris https://kopy.io/kx4uN#line-29 its a little crude but that line 29 pretty much makes the app silently error |
# |
Mar 6th 2018, 15:25 |
jeremyharris |
it shouldn’t fail silently then. maybe nothing’s failing at all? again, just shooting in the dark without seeing anything to go on |
# |
Mar 6th 2018, 15:24 |
flavius |
check the logs |
# |
Mar 6th 2018, 15:24 |
Es0teric |
jeremyharris, full debugging IS on... |
# |
Mar 6th 2018, 15:24 |
jeremyharris |
Es0teric well not sure I can help then, but turn on full debugging and error reporting and start digging through them logs :) |
# |
Mar 6th 2018, 15:22 |
popperz0r |
ok will try, thanks! |
# |
Mar 6th 2018, 15:22 |
flavius |
you could also turn on query logging and see the actual query and find out why it doesnt work, or see the query in debugkit |
# |
Mar 6th 2018, 15:22 |
jeremyharris |
(the first example is one with concat and column identifiers) |
# |
Mar 6th 2018, 15:22 |
jeremyharris |
see: https://book.cakephp.org/3.0/en/orm/query-builder.html#using-sql-functions |
# |
Mar 6th 2018, 15:21 |
jeremyharris |
try non-qualified field names, like first_name instead of User.first_name. Otherwise you need to tell cake they’re identifiers |