# |
Sep 4th 2019, 15:53 |
neon1024 |
https://book.cakephp.org/3.0/en/orm/query-builder.html#unions |
# |
Sep 4th 2019, 15:53 |
lilhermit |
I'm trying to do that |
# |
Sep 4th 2019, 15:52 |
neon1024 |
There is a whole bit in the book about sub-queries |
# |
Sep 4th 2019, 15:52 |
neon1024 |
So you’re doing `SELECT * FROM (SELECT x,y FROM..` query? |
# |
Sep 4th 2019, 15:45 |
neon1024 |
No idea then, I’m afraid. |
# |
Sep 4th 2019, 15:45 |
neon1024 |
I would question the need for a Union, but I’m sure there is a reason |
# |
Sep 4th 2019, 15:44 |
lilhermit |
yes I have a union and my understanding is I need to wrap it so that paginator LIMITs are not added to the first query |
# |
Sep 4th 2019, 15:43 |
lilhermit |
yes `->select('*')` adds table name and `as` |
# |
Sep 4th 2019, 15:42 |
neon1024 |
As long as you understand the implications of a `SELECT * FROM` query |
# |
Sep 4th 2019, 15:41 |
neon1024 |
Did you try `->select('*')` ? |
# |
Sep 4th 2019, 15:41 |
lilhermit |
I'm wrapping a query inside a `from` so paginator can will work with a union |
# |
Sep 4th 2019, 15:40 |
lilhermit |
Hi, anyone know if to stop QueryBuilder `select` method from add an alias. I want just `select * from ` rather than `select TableName.* as TableName__*` |
# |
Sep 4th 2019, 15:05 |
neon1024 |
:thumbsup: |
# |
Sep 4th 2019, 15:04 |
daniel.upshaw |
I think it was, thanks so much @neon1024 |
# |
Sep 4th 2019, 15:02 |
daniel.upshaw |
Maybe it's because of the ":" |
# |
Sep 4th 2019, 15:02 |
daniel.upshaw |
Got it! |
# |
Sep 4th 2019, 14:57 |
neon1024 |
Nor does your call to `->setPass()` |
# |
Sep 4th 2019, 14:56 |
neon1024 |
https://book.cakephp.org/3.0/en/development/routing.html#route-elements |
# |
Sep 4th 2019, 14:56 |
neon1024 |
Routes are matches sequentially, also your `->setPatterns()` call doesn’t need the `:` |
# |
Sep 4th 2019, 14:53 |
slackebot |
resulting in a 404 |
# |
Sep 4th 2019, 14:53 |
daniel.upshaw |
Investigating something odd with routes, not sure if anyone has run into this before... It seems to consume a route, disregarding the pattern, just based on the path parts E.g. ``` $routes->connect('/archive/:year', ['controller' => 'Posts', 'action' => 'index'] )->setPatterns([':year' => '\d{4}'])->setPass([':year']);``` Seems that this will consume `/archive/abcefg` even though it does not match the year pattern, |
# |
Sep 4th 2019, 14:10 |
davorminchorov |
Ok I solved it with allowEmptyString using a closure as a $when parameter |
# |
Sep 4th 2019, 14:08 |
val |
Hi, is there an alternative for `flushQueryCache()` method in 3.x? |
# |
Sep 4th 2019, 13:59 |
jotpe |
ah, it's get_class + Reflection |
# |
Sep 4th 2019, 13:58 |
ricksaccous |
I think that's how it works anyway |
# |
Sep 4th 2019, 13:57 |
ricksaccous |
just to forego that error message |
# |
Sep 4th 2019, 13:57 |
ricksaccous |
so maybe you want to do allowEmptyString('whatever', true) |
# |
Sep 4th 2019, 13:57 |
ricksaccous |
once you plop a rule on a field it's deemed not allowed to be empty |
# |
Sep 4th 2019, 13:57 |
ricksaccous |
that's why you're getting that weird error message |
# |
Sep 4th 2019, 13:57 |
ricksaccous |
usually the notEmpty rule is automatically applied unless you turn it off and that's the error message that pops up |
# |
Sep 4th 2019, 13:57 |
davorminchorov |
@ricksaccous nope |
# |
Sep 4th 2019, 13:56 |
jotpe |
and without the namespace? |
# |
Sep 4th 2019, 13:56 |
ricksaccous |
@davorminchorov did you specify allowEmptyString? |
# |
Sep 4th 2019, 13:56 |
dereuromark |
class name? basic php get_class() I would think |
# |
Sep 4th 2019, 13:55 |
jotpe |
For Tables I can use ->alias(); |
# |
Sep 4th 2019, 13:55 |
jotpe |
Hey! What's the way of getting the classname of an Entity when I have the object? |
# |
Sep 4th 2019, 13:52 |
davorminchorov |
notBlank for other fields I mean, not the one in the add() method specifically |
# |
Sep 4th 2019, 13:52 |
neon1024 |
Probably don’t want notBlank then I suppose |
# |
Sep 4th 2019, 13:51 |
slackebot |
<neon1024> |
# |
Sep 4th 2019, 13:51 |
davorminchorov |
Thanks! |
# |
Sep 4th 2019, 13:51 |
davorminchorov |
it's a string 0 :) |