# |
Apr 27th 2017, 14:10 |
Neon1024 |
Fuck off |
# |
Apr 27th 2017, 14:10 |
Lurdekan |
Neon1024: If you don't understand the question, nor have the answer, don't bother replying |
# |
Apr 27th 2017, 14:09 |
Neon1024 |
->sql() |
# |
Apr 27th 2017, 14:09 |
sms82ar |
Neon, declaring my own index worked. Thanks a lot! |
# |
Apr 27th 2017, 14:09 |
Neon1024 |
No idea then, good luck. |
# |
Apr 27th 2017, 14:09 |
Lurdekan |
Neon1024: But I wanted to do with one |
# |
Apr 27th 2017, 14:09 |
Lurdekan |
Neon1024: I explicitly said that I can do that with 2 queries |
# |
Apr 27th 2017, 14:09 |
Neon1024 |
If you’re trying to pre-optimise before you have code which works, then you’re wasting your own time |
# |
Apr 27th 2017, 14:09 |
Lurdekan |
Neon1024: that still leaves me with 2 queries |
# |
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 |