# |
Nov 30th 2017, 15:58 |
hmic |
and once you did, you better stay save and use the format everywhere ;-) |
# |
Nov 30th 2017, 15:58 |
hmic |
i use that pretty often |
# |
Nov 30th 2017, 15:58 |
hmic |
so you alias the user association differently, does not neet to be multiple associations, just by another name |
# |
Nov 30th 2017, 15:57 |
casmo |
Oke, point taken |
# |
Nov 30th 2017, 15:57 |
hmic |
or a user can be a owner of something |
# |
Nov 30th 2017, 15:57 |
hmic |
in an email app, a user can be aliased as a sender or receiver of a message |
# |
Nov 30th 2017, 15:57 |
casmo |
What kind of Aliases do you have for that? |
# |
Nov 30th 2017, 15:57 |
unclezoot |
yeah that worked, thanks guys |
# |
Nov 30th 2017, 15:57 |
hmic |
e.g. UsersTable |
# |
Nov 30th 2017, 15:56 |
casmo |
Give me an example |
# |
Nov 30th 2017, 15:56 |
hmic |
quite often actually, IMHO |
# |
Nov 30th 2017, 15:56 |
hmic |
casmo, needed everywhere where you use different aliases on the table |
# |
Nov 30th 2017, 15:54 |
casmo |
Mavisakalian: I can't help you with that error alone, can be anything |
# |
Nov 30th 2017, 15:54 |
casmo |
Only needed for queries that are in models with multiple associations under different names, no? |
# |
Nov 30th 2017, 15:54 |
casmo |
But I don't like to read it like that, tough |
# |
Nov 30th 2017, 15:54 |
casmo |
Even better yeah :) |
# |
Nov 30th 2017, 15:52 |
h.mavisakalian |
any thoughts on that warning ? |
# |
Nov 30th 2017, 15:51 |
hmic |
casmo, preferably with the correct alias, like: sprintf('%s.publish_to IS', $this->alias) :P |
# |
Nov 30th 2017, 15:50 |
casmo |
Posts.publish_to IS |
# |
Nov 30th 2017, 15:50 |
unclezoot |
(a LOT simpler) |
# |
Nov 30th 2017, 15:50 |
casmo |
Yeah, preferbly with Tablename in front of it |
# |
Nov 30th 2017, 15:50 |
unclezoot |
ill give it a go, thanks |
# |
Nov 30th 2017, 15:49 |
hmic |
you can just ->where(['publish_to IS' => null]) |
# |
Nov 30th 2017, 15:49 |
hmic |
no |
# |
Nov 30th 2017, 15:49 |
unclezoot |
thing is I need to check for NULL (where is null) so having to go down the expression builder route |
# |
Nov 30th 2017, 15:48 |
casmo |
Should work |
# |
Nov 30th 2017, 15:48 |
casmo |
->where(['or' => [['A' => 1, 'B' => 1]], ['C' => 1, 'D' => 1]]); |
# |
Nov 30th 2017, 15:48 |
hmic |
i dont think the code you show does work at all |
# |
Nov 30th 2017, 15:47 |
hmic |
unclezoot, there is a between expression you could use? |
# |
Nov 30th 2017, 15:46 |
unclezoot |
last attempt: https://www.pastiebin.com/5a2027c8655db |
# |
Nov 30th 2017, 15:44 |
unclezoot |
i.e. WHERE (A AND B) OR (C AND D) |
# |
Nov 30th 2017, 15:44 |
unclezoot |
could anyone give me some pointers on the cake ORM, specifically how to generate this WHERE condition: WHERE (publish_from <= CURRENT_DATE AND publish_to >= CURRENT_DATE) OR (publish_from is NULL AND publish_to IS NULL) |
# |
Nov 30th 2017, 15:43 |
h.mavisakalian |
“Warning (4096): Object of class Cake\View\Helper\FormHelper could not be converted to string” |
# |
Nov 30th 2017, 15:42 |
h.mavisakalian |
but works |
# |
Nov 30th 2017, 15:42 |
h.mavisakalian |
still gives that warning |
# |
Nov 30th 2017, 15:42 |
h.mavisakalian |
I did |
# |
Nov 30th 2017, 15:38 |
casmo |
test |
# |
Nov 30th 2017, 15:32 |
casmo |
And even better solutions than mine |
# |
Nov 30th 2017, 15:32 |
casmo |
Here is more info about the Form templates: https://book.cakephp.org/3.0/en/views/helpers/form.html#customizing-the-templates-formhelper-uses |
# |
Nov 30th 2017, 15:31 |
h.mavisakalian |
@casmo s solution |
# |
Nov 30th 2017, 15:31 |
kaliel |
what worked ? |