# |
Mar 19th 2019, 14:28 |
ricksaccous |
the solution is wonky javascript |
# |
Mar 19th 2019, 14:28 |
feLiruc |
Ohhh, my relationship is OK, the bake got it correct... my problem is to create the template with this 2 entities for the user... the fill the event, and N attendants in the same screen |
# |
Mar 19th 2019, 14:26 |
jeremyharris |
or perhaps a belongsToMany, if attendants can be part of multiple events |
# |
Mar 19th 2019, 14:25 |
jeremyharris |
feLiruc I think you are looking for a hasMany relationship. you can find information about it here: https://book.cakephp.org/3.0/en/orm/associations.html#hasmany-associations |
# |
Mar 19th 2019, 13:27 |
feLiruc |
Hello guys, can anybody help me how to create an add page to create a 1 to n information? Like event and attendant... |
# |
Mar 19th 2019, 12:19 |
feLiruc |
Hello guys... what´s the smartest way to create an add page to create a 1 to n relationship model? like, one event with a list of participants... I want to add the participants list just in 1 page. |
# |
Mar 19th 2019, 08:02 |
challgren |
np |
# |
Mar 19th 2019, 06:21 |
latenal |
@challgren, you were right. This is an accessibility problem. There was ‘monitors’ in the list not `monitor` Thanks a lot! |
# |
Mar 19th 2019, 06:14 |
latenal |
Here is it: https://book.cakephp.org/3.0/en/orm/saving-data.html#saving-hasone-associations The problem is that in the example they create *a new entity with an ID*. I don’t have an ID when I create a record. It’s auto-incremented. |
# |
Mar 19th 2019, 06:11 |
latenal |
I’ve read it multiple times. I think everything is according to the doc, but it doesn’t work |
# |
Mar 19th 2019, 06:10 |
latenal |
This is the data: `Array ( [firstname] => TestName [lastname] => TestLastname [cellphone] => 1231231231 [username] => monitor2 [monitor] => Array ( [department_id] => 1 ) )` |
# |
Mar 19th 2019, 06:09 |
challgren |
https://book.cakephp.org/3.0/en/orm/saving-data.html#patching-hasmany-and-belongstomany |
# |
Mar 19th 2019, 06:08 |
latenal |
Yes |
# |
Mar 19th 2019, 06:04 |
challgren |
Accessible |
# |
Mar 19th 2019, 03:23 |
slackebot2 |
$this->Users->save($entity, [‘associated’ => [‘Monitors’]])) ` It saves the `User`, but it doesn’t save `Monitor` data How do I save the assoc model? |
# |
Mar 19th 2019, 03:23 |
latenal |
Hey, I am using cake 3.7 I am trying to save hasOne but it never saves the associated value. There are 2 tables Users and Monitors (one-to-one) ` $this->hasOne(‘Monitors’, [ ‘foreignKey’ => ‘user_id’, ‘joinType’ => ‘INNER’ ]) ` This is the way I save it: ` $entity = $this->Users->newEntity(); $entity = $this->Users->patchEntity($entity, $data, [‘associated’ => [‘Monitors’]]); |
# |
Mar 19th 2019, 02:16 |
chrisshick |
It had to do with the CRUD api plugin that I use. It automatically enables the query log |
# |
Mar 19th 2019, 02:16 |
chrisshick |
@markstory I found the issue. |
# |
Mar 18th 2019, 22:03 |
massimoi |
Hi, I've got a question about page cache (cake 2.x). I'm using caching for static pages (Pages/name.ctp). When I enable translations, the cache "hides" the translation (es: eng/pages/name == ita/pages/name), *how should I configure the cache?* |
# |
Mar 18th 2019, 21:37 |
itmpls |
n/m, scope doh |
# |
Mar 18th 2019, 21:36 |
itmpls |
how can I add another unique constraint so its 2 fields instead of one? for ex `->add('field','unique',['rule' => 'validateUnique']);` |
# |
Mar 18th 2019, 19:17 |
m |
even I did not think that haha :slightly_smiling_face: I'm just a worthless guy.. and will go cry in a corner by myself eating cookies |
# |
Mar 18th 2019, 19:16 |
admad |
@m of course if was your fault, no body thought otherwise :slightly_smiling_face: |
# |
Mar 18th 2019, 19:09 |
m |
@admad: I'm honest enough: It was my own fault, I was updating the wrong (similar named and similar path.. ) project folder .. which was still at an earlier version of Cake. So it works and is fixed. Thanks again for your help. |
# |
Mar 18th 2019, 18:28 |
m |
yes, was doing that now :slightly_smiling_face: thanks |
# |
Mar 18th 2019, 18:28 |
admad |
delete your vendor/cakephp/cakephp folder and run composer update again |
# |
Mar 18th 2019, 18:27 |
admad |
@m you mention `compact('etagMatches', 'timeMatches')` generating errors in Response class. But Response class no longer has any compact() call https://github.com/cakephp/caakephp/blob/3.7.5/src/Http/Response.php |
# |
Mar 18th 2019, 18:27 |
m |
but i can see the fix at github; so ill figure it out myself. Thanks for your time |
# |
Mar 18th 2019, 18:26 |
slackebot2 |
<birdy247> |
# |
Mar 18th 2019, 18:26 |
m |
hm; any idea why i dont have it when i'm at 3.7.5 ? |
# |
Mar 18th 2019, 18:26 |
admad |
@m that fix was done quite a quite ago, it is present in latest release |
# |
Mar 18th 2019, 18:25 |
birdy247 |
if i perform the exact same callback in "name" |
# |
Mar 18th 2019, 18:25 |
slackebot2 |
<birdy247> |
# |
Mar 18th 2019, 18:25 |
chris-andre |
@birdy247 Not sure how/why, but name has to come from somewhere? From the entity being patched? |
# |
Mar 18th 2019, 18:25 |
birdy247 |
if I check the data higher up i.e. name |
# |
Mar 18th 2019, 18:25 |
m |
ive checked github for cakephp/cakephp dev-master and i see a "php7.3" fix. Could it be that dev-master fixes that? instead of ^3.7 ? |
# |
Mar 18th 2019, 18:24 |
birdy247 |
This is odd |
# |
Mar 18th 2019, 18:23 |
m |
It's probably my fault, somewhere, but I can't put my finger on it; it seems to be Cake (to me at the moment) |
# |
Mar 18th 2019, 18:22 |
m |
admad: I am using 3.7.5 (checked the file in vendor and ran composer again given ^3.7 |
# |
Mar 18th 2019, 18:20 |
birdy247 |
yet the entity has "name" set |
# |
Mar 18th 2019, 18:20 |
birdy247 |
data is empty |