# |
Apr 27th 2017, 14:09 |
Neon1024 |
So do that first |
# |
Apr 27th 2017, 14:08 |
Lurdekan |
Neon1024: In this case the parameter was not fetched yet |
# |
Apr 27th 2017, 14:08 |
Neon1024 |
->find(‘published’, [‘date’ => $date]) |
# |
Apr 27th 2017, 14:08 |
Neon1024 |
I usually just pass the array that I need |
# |
Apr 27th 2017, 14:07 |
Neon1024 |
No idea, I’ve never had to do that |
# |
Apr 27th 2017, 14:07 |
Lurdekan |
Neon1024: My question was exactly if there's any way to properly set the array option for a custom finder in the association's definition |
# |
Apr 27th 2017, 14:07 |
Lurdekan |
Neon1024: The finder still needs a proper set $option array |
# |
Apr 27th 2017, 14:07 |
sms82ar |
Thanks Neon, I'll try again to write my own by just declaring it, when I did it before It didn't return the results from the query so I figured I messed up |
# |
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 |