# |
Oct 4th 2018, 15:35 |
ricksaccous |
I'm not sure i can solve your problem, but i'm curious about it, lol |
# |
Oct 4th 2018, 15:34 |
rudy1976s |
sure |
# |
Oct 4th 2018, 15:34 |
ricksaccous |
can i see a sample row of both tables |
# |
Oct 4th 2018, 15:34 |
rudy1976s |
I see that cake saves CFK using keys plus ";" |
# |
Oct 4th 2018, 15:34 |
rudy1976s |
it should |
# |
Oct 4th 2018, 15:32 |
ricksaccous |
is item_id a concat of code and category_id or something |
# |
Oct 4th 2018, 15:32 |
rudy1976s |
code and category is are in the Products Group table and item_id on Attachments table |
# |
Oct 4th 2018, 15:32 |
ricksaccous |
what two fields match in those tables |
# |
Oct 4th 2018, 15:32 |
ricksaccous |
?? |
# |
Oct 4th 2018, 15:31 |
ricksaccous |
but i'm saying, wouldn't the keys have to correspond |
# |
Oct 4th 2018, 15:31 |
rudy1976s |
I have a single table used for attachments |
# |
Oct 4th 2018, 15:30 |
ricksaccous |
what logic would you even use for that |
# |
Oct 4th 2018, 15:30 |
ricksaccous |
how does code and category id correspond to foreignKey though, heh |
# |
Oct 4th 2018, 15:29 |
rudy1976s |
snippet of the table |
# |
Oct 4th 2018, 15:29 |
rudy1976s |
https://gist.github.com/rudy1976s/59edd5dbf8940975677d6823822a9fca |
# |
Oct 4th 2018, 15:29 |
rudy1976s |
yes |
# |
Oct 4th 2018, 15:29 |
ricksaccous |
@rudy1976s correct? |
# |
Oct 4th 2018, 15:28 |
ricksaccous |
and binding Key is the array of two keys |
# |
Oct 4th 2018, 15:28 |
ricksaccous |
so when you set foreignKey it should be a string value of the field |
# |
Oct 4th 2018, 15:28 |
ricksaccous |
? |
# |
Oct 4th 2018, 15:28 |
ricksaccous |
and foreign key is one field |
# |
Oct 4th 2018, 15:28 |
ricksaccous |
so binding key is composite |
# |
Oct 4th 2018, 15:27 |
rudy1976s |
but in the Attachment table I don't need composite keys |
# |
Oct 4th 2018, 15:27 |
rudy1976s |
yes |
# |
Oct 4th 2018, 15:25 |
ricksaccous |
have you set them up as suggested? |
# |
Oct 4th 2018, 15:25 |
ricksaccous |
they go over setting up composite key options here https://book.cakephp.org/3.0/en/orm/associations.html#hasmany-associations |
# |
Oct 4th 2018, 15:23 |
rudy1976s |
keys |
# |
Oct 4th 2018, 15:23 |
rudy1976s |
unfortunately i have to deal with compiste kets |
# |
Oct 4th 2018, 15:23 |
rudy1976s |
ah ah |
# |
Oct 4th 2018, 15:23 |
ricksaccous |
@rudy1976s migrate to a none-composite key, lull |
# |
Oct 4th 2018, 15:21 |
rudy1976s |
I also specified bindingKey on the ProductsGroups model association against Attachments |
# |
Oct 4th 2018, 15:18 |
slackebot |
contain attachments: : error is "Cannot convert value of type `array` to string" could you please help me a bit ? |
# |
Oct 4th 2018, 15:18 |
rudy1976s |
today for the first time I had to deal with composite foreign keys : I found some issue regarding associations: I have a model called ProductsGroups which has a composite foreign key with code and category_id: I need to associate this model to attachments model where the foreign key of the association on attachment model is item_id ( which should store the composite key ? ) I have the following error on a query where I use ProductsGroups |
# |
Oct 4th 2018, 15:14 |
rudy1976s |
good afternoon |
# |
Oct 4th 2018, 15:13 |
btx |
what, nooo - look at the Cake example |
# |
Oct 4th 2018, 15:12 |
clynch |
It is :( |
# |
Oct 4th 2018, 15:12 |
ricksaccous |
with the same logic, lol |
# |
Oct 4th 2018, 15:12 |
ricksaccous |
oh, i thought it was the same exact function duplicated |
# |
Oct 4th 2018, 15:12 |
btx |
traits would only help if you have the *same* options available in each Task (like a help function) |
# |
Oct 4th 2018, 15:11 |
ricksaccous |
@clynch can probably use traits in this case? |
# |
Oct 4th 2018, 15:10 |
clynch |
K, good. Like I said, it is just odd having the same exact function on both files in order for it to work. Maybe it is just something I will just have to live with. I am not a fan of redundancy. |