# |
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 |
# |
Oct 12th 2017, 16:33 |
hmic |
$this->find() on a table gives you a ORM\Query instance back |
# |
Oct 12th 2017, 16:32 |
hmic |
you use it from a table anyways, do you? |
# |
Oct 12th 2017, 16:32 |
hmic |
so? |
# |
Oct 12th 2017, 16:32 |
rrd564 |
I have started with that but the constructor of ORM\Query requires a table as the second argument |
# |
Oct 12th 2017, 16:31 |
hmic |
alecilla: you should stop useing action and use url instead, as action will stop working in the next release |
# |
Oct 12th 2017, 16:31 |
dereuromark |
use the documented "url" key. |
# |
Oct 12th 2017, 16:31 |
dereuromark |
exactly what it says. |
# |
Oct 12th 2017, 16:31 |
alecilla |
what mean Deprecated (16384): Using key `action` is deprecated, use `url` directly instead. [CORE/Cake/View/Helper/FormHelper.php, line 383] |
# |
Oct 12th 2017, 16:31 |
hmic |
so just start with a ORM\Query instead of a Database\Query and you should be fine |
# |
Oct 12th 2017, 16:30 |
hmic |
so you need to express your query with what ORM\Query gives you. It is a subclas of Database\Query, so you should be able to use the interface too |
# |
Oct 12th 2017, 16:30 |
rrd564 |
I want to use ORM/Query, just was not able to figure out how to build the same query with it |
# |
Oct 12th 2017, 16:29 |
hmic |
so you want to use Database\Query but use the ORM\Query interface? - thats not going to happen. the other way round is not problem though |
# |
Oct 12th 2017, 16:23 |
rrd564 |
and I guess I can not chain it |
# |
Oct 12th 2017, 16:23 |
rrd564 |
So for example I can not call ->first(), ->toArray() on the return value |
# |
Oct 12th 2017, 16:22 |
rrd564 |
I get the SQL what I want but I use the Database/Query builder not the ORM/Query |
# |
Oct 12th 2017, 16:22 |
alecilla |
ok |
# |
Oct 12th 2017, 16:22 |
hmic |
still not available outside slack |