# |
Apr 27th 2017, 14:06 |
Neon1024 |
Sounds like you need to use a finder then |
# |
Apr 27th 2017, 14:05 |
Lurdekan |
Neon1024: That doc I know very well, the conditions key doesnt allow for you to pass parameters from the original containing row |
# |
Apr 27th 2017, 14:05 |
Neon1024 |
Or write your own Crud action class |
# |
Apr 27th 2017, 14:05 |
Neon1024 |
Crud will only execute if a controller method is missing, or you ask it to in your method |
# |
Apr 27th 2017, 14:04 |
Neon1024 |
Just write your own then |
# |
Apr 27th 2017, 14:04 |
sms82ar |
I need to modify index action, previous message don't make sense |
# |
Apr 27th 2017, 14:03 |
Neon1024 |
Or go read the source code |
# |
Apr 27th 2017, 14:03 |
Neon1024 |
Just look in DebugKit’s SQL panel |
# |
Apr 27th 2017, 14:03 |
sms82ar |
Hi, I'm using friend's of cake crud plugin but I need to how index action works, particularly the query behind it. Can anyone provide an example of how to achieve this?. I haven't been able to find suitable docs. |
# |
Apr 27th 2017, 14:03 |
Neon1024 |
Associations take a ‘conditions’ key |
# |
Apr 27th 2017, 14:03 |
Neon1024 |
https://book.cakephp.org/3.0/en/orm/associations.html#hasone-associations |
# |
Apr 27th 2017, 13:53 |
Lurdekan |
I want to setup an association between a "CursosSequencias" and the "CursosSequencias" that comes right before it in the order set |
# |
Apr 27th 2017, 13:52 |
Lurdekan |
this property is called "sequencia" |
# |
Apr 27th 2017, 13:52 |
Lurdekan |
"CursosSequencias" have a number to order them |
# |
Apr 27th 2017, 13:52 |
Lurdekan |
many "CursosSequencias" belong to a single "Cursos" |
# |
Apr 27th 2017, 13:51 |
Lurdekan |
while "CursosSequencias" is a form of extension of "Cursos" |
# |
Apr 27th 2017, 13:51 |
Lurdekan |
is this scenario, the key "codigo" is the primary key of "Cursos" |
# |
Apr 27th 2017, 13:51 |
Lurdekan |
I know I can do it in the query itself, but I really would apreciate if I could do it in the definition |
# |
Apr 27th 2017, 13:50 |
Lurdekan |
$this->hasOne('SequenciasAnteriores', [ 'className' => 'CursosSequencias', 'foreignKey' => 'codigo', 'bindingKey' => 'codigo', 'conditions' => [ 'SequenciasAnteriores.sequencia = (CursosSequencias.sequencia - 1)' ], 'joinType' => 'left', 'strategy' => 'select' ]); |
# |
Apr 27th 2017, 13:50 |
Lurdekan |
this is how I'm defining the association |
# |
Apr 27th 2017, 13:49 |
Lurdekan |
in order to cherrypick the association? |
# |
Apr 27th 2017, 13:49 |
Lurdekan |
other than the binding key? |
# |
Apr 27th 2017, 13:49 |
Lurdekan |
what if I need to pass more parameters from the containing row? |
# |
Apr 27th 2017, 13:49 |
Lurdekan |
that will receive the bindingKey as parameter |
# |
Apr 27th 2017, 13:49 |
Lurdekan |
it will generate a subquery |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
and selects subquery as strategy |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
with a binding key |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
I mean, when you define an association |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
how can I pass more conditions to the association subquery? |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
didn't find it in the docs |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
I need some piece of information |
# |
Apr 27th 2017, 13:48 |
Lurdekan |
how u doin? |
# |
Apr 27th 2017, 13:47 |
Lurdekan |
hello fellas |
# |
Apr 27th 2017, 13:27 |
megan |
:parrotparty: |
# |
Apr 27th 2017, 13:22 |
btx |
41 DAYS TIL CAKEFEST! |
# |
Apr 27th 2017, 13:08 |
inoas |
what's the recommended practise to create where conditions where the left side would clash |
# |
Apr 27th 2017, 12:53 |
inoas |
I can conjunct things with $value but then I will lose injection protection |
# |
Apr 27th 2017, 12:53 |
inoas |
I will only get locale_code LIKE once as it gets overwritten |
# |
Apr 27th 2017, 12:53 |
inoas |
when I run code like this pr($collection->unfold()->map(function($value) { return ['locale_code LIKE' => $value]; })->toArray()); |
# |
Apr 27th 2017, 12:53 |
inoas |
https://gist.github.com/inoas/e127826d9c9be368757169bbb370f2e0#file-find-best-locale-path-sql-L8-L11 |
# |
Apr 27th 2017, 12:53 |
inoas |
on the left side I have always the same (or just 2) identifier |