# |
Oct 12th 2017, 17:07 |
rrd564 |
I found it. Is there a way to tell beforeFilter to do not fire for one find? |
# |
Oct 12th 2017, 17:00 |
rrd564 |
but I am able to solve that my own - I hope... :) |
# |
Oct 12th 2017, 16:59 |
rrd564 |
at least I got and SQL error what complaining about an inner part of the query, and the generated SQL seems to be the thing i want |
# |
Oct 12th 2017, 16:59 |
rrd564 |
hm, i think it is solved like this: https://gist.github.com/rrd108/2aedefdaf28bef2919321f8e36f98e68 |
# |
Oct 12th 2017, 16:54 |
hmic |
maybe ['da.*', 'ca.*'] could do too |
# |
Oct 12th 2017, 16:53 |
hmic |
but listing the aliased fields should do, if thats the only problem left ;-) |
# |
Oct 12th 2017, 16:53 |
hmic |
could work too, sure. i wonder why the * does add the alias for you, it did not with me. but then again, i did not leftjoin. so that might be it |
# |
Oct 12th 2017, 16:52 |
hmic |
please try without leftJoin and without table alias, exactly like i did $table->find()->select('*')->from($q) |
# |
Oct 12th 2017, 16:52 |
rrd564 |
I did not tried that ne yet |
# |
Oct 12th 2017, 16:52 |
rrd564 |
should I manually list all fileds there from the temporary tables? |
# |
Oct 12th 2017, 16:51 |
rrd564 |
yes |
# |
Oct 12th 2017, 16:51 |
hmic |
oh, its the select * thats the showstopper |
# |
Oct 12th 2017, 16:51 |
rrd564 |
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AS `Tetelek__*` FROM (SELECT Osztalyok.id AS `oId`, Osztalyok.nev AS `oNev`, Tar' at line 1 |
# |
Oct 12th 2017, 16:51 |
hmic |
can you pass the query like i did to the from |
# |
Oct 12th 2017, 16:50 |
hmic |
i'd not had the leftJoin added already, but the idea is the same, sure |
# |
Oct 12th 2017, 16:50 |
rrd564 |
The generated SQL starts with this: SELECT Tetelek.* AS `Tetelek__*` |
# |
Oct 12th 2017, 16:50 |
hmic |
what you get? |
# |
Oct 12th 2017, 16:50 |
rrd564 |
like this? |
# |
Oct 12th 2017, 16:49 |
rrd564 |
https://gist.github.com/rrd108/2aedefdaf28bef2919321f8e36f98e68 |
# |
Oct 12th 2017, 16:49 |
rrd564 |
I updatedte ist |
# |
Oct 12th 2017, 16:48 |
hmic |
add ->select('*') too |
# |
Oct 12th 2017, 16:47 |
hmic |
now you create a new ORM\Query from your table and pass it like ->find()->from($debitAbstract) |
# |
Oct 12th 2017, 16:47 |
rrd564 |
i have it, it is $debitAbstract |
# |
Oct 12th 2017, 16:46 |
hmic |
which by itself can be executed and gives you (a) desired result |
# |
Oct 12th 2017, 16:46 |
hmic |
so you are not able to build the query from line 4 till line 28? |
# |
Oct 12th 2017, 16:46 |
rrd564 |
:slightly_smiling_face: that is where I stucked |
# |
Oct 12th 2017, 16:45 |
hmic |
thats easy, is it? |
# |
Oct 12th 2017, 16:45 |
hmic |
use the cake ORM\Query to build the query you want to be used in the from |
# |
Oct 12th 2017, 16:45 |
hmic |
ok. lets start with one thing |
# |
Oct 12th 2017, 16:44 |
rrd564 |
hm, how do you mean? |
# |
Oct 12th 2017, 16:44 |
hmic |
IMHO |
# |
Oct 12th 2017, 16:44 |
hmic |
additionally, you still dont need that, as you union anyways in the end |
# |
Oct 12th 2017, 16:43 |
inoas |
if it is just for reading your can emulate things like that by SQL VIEWs |
# |
Oct 12th 2017, 16:43 |
rrd564 |
because i have to simulate a full outer join in mysql, and for that I have to make an union of a keft join and a right join |
# |
Oct 12th 2017, 16:43 |
inoas |
why do you need that? |
# |
Oct 12th 2017, 16:42 |
hmic |
why does the from need to be a tmp table? |
# |
Oct 12th 2017, 16:41 |
rrd564 |
no space between the _ and * just slack make the text bold... |
# |
Oct 12th 2017, 16:40 |
rrd564 |
yes, but than I get SELECT table.* AS table__* |
# |
Oct 12th 2017, 16:38 |
hmic |
you can select * |
# |
Oct 12th 2017, 16:38 |
rrd564 |
A temporary table |
# |
Oct 12th 2017, 16:37 |
rrd564 |
well i that case I would get an SQL like SELECT x,y,z FROM table, but what I need is not that but this: https://gist.github.com/rrd108/1c0f2688e5e867b5c388a2f723fe23ac |