# |
Mar 6th 2018, 15:48 |
flavius |
you could make a new table field called full_name and save in it the contents of first_name and last_name to avoid this all together :slightly_smiling_face: |
# |
Mar 6th 2018, 15:48 |
Es0teric |
flavius i fixed that and still |
# |
Mar 6th 2018, 15:45 |
popperz0r |
will try |
# |
Mar 6th 2018, 15:45 |
dereuromark |
you need to repeat the exact condition in the other parts of the SQL ( in your case inside the conditions just as it was defined in fields) |
# |
Mar 6th 2018, 15:44 |
dereuromark |
somewhat this one https://github.com/cakephp/cakephp/issues/1835 (or other related ones) |
# |
Mar 6th 2018, 15:44 |
ghoritrilochan |
shreehariji.com link |
# |
Mar 6th 2018, 15:44 |
ghoritrilochan |
i was upload my project in server but css,js,img and link all was not work... plz help |
# |
Mar 6th 2018, 15:44 |
flavius |
somehow :P |
# |
Mar 6th 2018, 15:43 |
flavius |
try to make it look like `WHERE( (CONCAT(User.first_name, :param0, User.last_name)) like :c1` |
# |
Mar 6th 2018, 15:43 |
popperz0r |
:( |
# |
Mar 6th 2018, 15:42 |
dereuromark |
A known 2.x limitation |
# |
Mar 6th 2018, 15:42 |
flavius |
`WHERE (full_name` this is your problem |
# |
Mar 6th 2018, 15:42 |
popperz0r |
ffs |
# |
Mar 6th 2018, 15:42 |
slackebot |
LeadType ON LeadType.id = (UnqualifiedLead.lead_type_id) WHERE (full_name like :c1 AND Email.email like :c2) ORDER BY UnqualifiedLead.id desc``` |
# |
Mar 6th 2018, 15:42 |
popperz0r |
``` (CONCAT(User.first_name, :param0, User.last_name)) AS `full_name` FROM unqualified_lead UnqualifiedLead LEFT JOIN user User ON User.id = (UnqualifiedLead.user_id) LEFT JOIN phone Phone ON Phone.id = (UnqualifiedLead.phone_id) LEFT JOIN email Email ON Email.id = (UnqualifiedLead.email_id) LEFT JOIN city City ON City.id = (UnqualifiedLead.city_id) LEFT JOIN company Company ON Company.id = (UnqualifiedLead.company_id) LEFT JOIN lead_type |
# |
Mar 6th 2018, 15:42 |
popperz0r |
```Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'full_name' in 'where clause'``` |
# |
Mar 6th 2018, 15:42 |
popperz0r |
@jeremyharris after remaking my whole query :( |
# |
Mar 6th 2018, 15:42 |
jeremyharris |
then it’s a problem with whatever is consuming that array. doesn’t change the fact that you should fix your controller :) |
# |
Mar 6th 2018, 15:42 |
flavius |
https://kopy.io/shlHV#line-10 overwrites https://github.com/cakephp/cakephp/blob/2.x/lib/Cake/Controller/Controller.php#L319 |
# |
Mar 6th 2018, 15:41 |
Es0teric |
because when i make it a flat array, the app works as expected |
# |
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` |