# |
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 |
# |
Mar 6th 2018, 15:20 |
popperz0r |
```Error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '.`full_name`, LeadType.label AS `LeadType__label`, Email.email AS `Email__email`' at line 1 ``` |
# |
Mar 6th 2018, 15:20 |
jeremyharris |
@popperz0r what’s the error |
# |
Mar 6th 2018, 15:20 |
Es0teric |
however, i am not entirely sure if it has to do with the plugin setup... eventhough its setup the default way plugins are |
# |
Mar 6th 2018, 15:20 |
slackebot |
'order' => ['UnqualifiedLead.id' => 'desc'] ])``` |
# |
Mar 6th 2018, 15:20 |
popperz0r |
```$unqualified_leads_table = $this->UnqualifiedLead->find('all',[ 'fields' => ['id', 'name', 'user_id', 'User.first_name', 'User.last_name', 'User.full_name' => $this->UnqualifiedLead->query()->func()->concat(['User.first_name', ' ', 'User.last_name']), 'LeadType.label', 'Email.email', 'Phone.number', 'City.city_name'], 'contain' => ['User', 'Phone', 'Email', 'City', 'Company', 'LeadType'], |
# |
Mar 6th 2018, 15:20 |
popperz0r |
@jeremyharris im not able to fetch results now :) |
# |
Mar 6th 2018, 15:19 |
Es0teric |
jeremyharris, sure... give me a sec |
# |
Mar 6th 2018, 15:17 |
jeremyharris |
can you provide a minimal example of what’s happening? |