# |
Feb 20th 2020, 11:06 |
dereuromark |
atomic queries always work on any table. |
# |
Feb 20th 2020, 11:05 |
dereuromark |
sure. |
# |
Feb 20th 2020, 11:05 |
viraj.khatavkar |
Is it possible to run `updateAll` on the join table in a belongsToMany association? The join table doesn’t have it’s own model. Eg. I have a `roles` , `users` and `roles_users` tables. I want to bulk update on the `roles_users` table. |
# |
Feb 20th 2020, 11:04 |
tomrwaller |
No worries - thank you for having a look anyway, much appreciated! |
# |
Feb 20th 2020, 11:03 |
challgren |
Hmm sorry thats my only solution, don’t really know the forms that well |
# |
Feb 20th 2020, 11:03 |
tomrwaller |
Thanks @challgren - I swapped out the input for the below but I'm still seeing the same behaviour. `echo $this->Form->input('associated_technologies_.ids', array(` `'type' => 'select',` `'multiple'=>'checkbox',` `'options' => $associatedTechnologies` `));` |
# |
Feb 20th 2020, 10:58 |
challgren |
I think you need a ‘multiple’ => ‘checkbox’ there for associated_technologies |
# |
Feb 20th 2020, 10:44 |
slackebot |
actually selected. |
# |
Feb 20th 2020, 10:44 |
tomrwaller |
If I debug the data on the add the request looks like this: ```[ 'recommendation_group_id' => '1', 'name' => 'e1', 'recommendation' => 'e1', 'rationale' => 'e1', 'primary_technology_id' => '1', 'associated_technologies' => [ '_ids' => '4' ], 'assessments' => [ '_ids' => '2' ]``` I was expecting to see an array in _ids => 4 as I selected 4 entries in the select but it looks like it is giving a count, not a list of ids I |
# |
Feb 20th 2020, 10:42 |
tomrwaller |
This is what I have in my add.php. |
# |
Feb 20th 2020, 10:41 |
tomrwaller |
echo $this->Form->control('primary_technology_id', ['options' => $primaryTechnologies]);echo $this->Form->control('associated_technologies._ids', ['options' => $associatedTechnologies]); |
# |
Feb 20th 2020, 10:41 |
tomrwaller |
That's my RecommendationsTechnologiesTable. |
# |
Feb 20th 2020, 10:40 |
tomrwaller |
`$this->belongsTo('Recommendations', [` `'foreignKey' => 'recommendation_id',` `'joinType' => 'INNER',` `]);` `$this->belongsTo('Technologies', [` `'foreignKey' => 'technology_id',` `'joinType' => 'INNER',` `]);` |
# |
Feb 20th 2020, 10:40 |
tomrwaller |
That's my RecommendationsController. |
# |
Feb 20th 2020, 10:40 |
slackebot |
`'targetForeignKey' => 'technology_id',` `'joinTable' => 'recommendations_technologies',` `]);` |
# |
Feb 20th 2020, 10:40 |
tomrwaller |
`$this->belongsTo('PrimaryTechnologies', [` `'className' => 'Technologies',` `'foreignKey' => 'primary_technology_id',` `'joinType' => 'INNER',` `]);` `$this->belongsToMany('AssociatedTechnologies', [` `'className' => 'Technologies',` `'foreignKey' => 'recommendation_id',` |
# |
Feb 20th 2020, 10:39 |
slackebot |
Recommendations I have defined two associations to Technologies. Trouble is, the multiselect on add.php doesn't set the Associated Technologies. The Primary Technology does however get set. |
# |
Feb 20th 2020, 10:39 |
tomrwaller |
Hey all - would someone mind casting their eyes over my models? Not sure I'm doing this right. I have Technologies and I have Recommendations. They are joined using the recommendations_technologies table. In the recommendation, I have two fields, one is Primary Technology which is a choice of one from the technologies table, and another field Associated Technologies which can be multiple entries from the technology field. So essentially in |
# |
Feb 20th 2020, 09:31 |
alexdd55976 |
yeah.. i figured it out.. the docs have been better then expected :) |
# |
Feb 20th 2020, 09:23 |
challgren |
@alexdd55976 do you mean when you run `bin/cake bake ….` |
# |
Feb 20th 2020, 08:32 |
alexdd55976 |
ah got it |
# |
Feb 20th 2020, 08:30 |
alexdd55976 |
is there a way to change bake templates so they won't be overwritten during an update |
# |
Feb 20th 2020, 08:29 |
christianjohn.gss |
i'll keep that in mind. |
# |
Feb 20th 2020, 08:28 |
conehead |
that it why you include the parent call to make sure the default behavior is still used as well |
# |
Feb 20th 2020, 08:28 |
christianjohn.gss |
thank you @conehead :) |
# |
Feb 20th 2020, 08:27 |
christianjohn.gss |
that makes sense |
# |
Feb 20th 2020, 08:27 |
christianjohn.gss |
ohhhhhh |
# |
Feb 20th 2020, 08:27 |
christianjohn.gss |
yes and it came back like the first picture |
# |
Feb 20th 2020, 08:27 |
conehead |
probably because you overwrite the default beforeRender mechanics that set this theme |
# |
Feb 20th 2020, 08:26 |
conehead |
Did you try what admad said? |
# |
Feb 20th 2020, 08:26 |
christianjohn.gss |
because i was suppose to add `$this->viewBuilder()->setTheme(null);` to display the login page in full |
# |
Feb 20th 2020, 08:25 |
christianjohn.gss |
i just want to understand why having beforeRender removed the theme |
# |
Feb 20th 2020, 08:25 |
conehead |
so where is your problem @christianjohn.gss? |
# |
Feb 20th 2020, 08:00 |
christianjohn.gss |
@admad i did not call the parent method inside it |
# |
Feb 20th 2020, 07:59 |
christianjohn.gss |
with the method |
# |
Feb 20th 2020, 07:59 |
slackebot |
<christianjohn.gss> |
# |
Feb 20th 2020, 07:59 |
christianjohn.gss |
without beforeRender method |
# |
Feb 20th 2020, 07:59 |
slackebot |
<christianjohn.gss> |
# |
Feb 20th 2020, 07:58 |
admad |
did you forget to call parent::beforeRender() ? |
# |
Feb 20th 2020, 07:56 |
christianjohn.gss |
i am currently using adminlte theme at cakephp 3 and i was trying to set the default route to a login page, and when i write a beforeRender function, the theme went away even without the setTheme(null) |
# |
Feb 20th 2020, 07:55 |
christianjohn.gss |
i got a question |