Log message #4198475

# At Username Text
# Aug 15th, 18:50 ricksaccous it's not using the actual roles table class when you do that though
# Aug 15th, 18:50 challgren did you try find()->where([])->contain()
# Aug 15th, 18:50 ricksaccous yeah because it uses magic
# Aug 15th, 18:50 jotpe o.O
# Aug 15th, 18:50 jotpe Without the contain the find is working without plugin prefix
# Aug 15th, 18:49 ricksaccous oh yeah lol
# Aug 15th, 18:49 ndm I never liked these magic tables
# Aug 15th, 18:49 jotpe Ty :slightly_smiling_face:
# Aug 15th, 18:48 jotpe I know it's gonna hurt @ndm
# Aug 15th, 18:46 ndm @jotpe `->get('Users.Users')`
# Aug 15th, 18:44 jotpe got the same error @ricksaccous
# Aug 15th, 18:43 mrfeedback how to handle massassignments with Authorization plugin? `$collectionparts = $this->Collectionparts->patchEntities($collectionparts,$data); $this->Authorization->can($collectionparts,'update'); ` throws an error ` Error: [Authorization\Policy\Exception\MissingPolicyException] Policy for 'array' has not been defined.`
# Aug 15th, 18:43 slackebot <jotpe>
# Aug 15th, 18:43 slackebot <jotpe>
# Aug 15th, 18:37 jotpe So with a through model you mean create the mdel classes for roles_users?
# Aug 15th, 18:34 ricksaccous and creating that middle man model
# Aug 15th, 18:34 ricksaccous i always like using the through or whatever the option is called though
# Aug 15th, 18:33 ricksaccous so that's why i wanted to see if there's something wrong in your association config there that's breaking things
# Aug 15th, 18:33 ricksaccous it will just assume the join table, and you're following conventions
# Aug 15th, 18:33 jotpe actually it#s a bit strange. it uses mostly the same config as the CMS tutorial: https://book.cakephp.org/3.0/en/quickstart.html#cms-tutorial-creating-the-database
# Aug 15th, 18:32 jotpe just the classname shouldn't work...it uses the join table
# Aug 15th, 18:30 ricksaccous if that doesn't work then maybe create a through model and use the through option as well
# Aug 15th, 18:29 ricksaccous wait a minute
# Aug 15th, 18:29 ricksaccous other configs...
# Aug 15th, 18:29 ricksaccous does it work?
# Aug 15th, 18:29 ricksaccous if you try it with just className defined and take out the other ones from the association config
# Aug 15th, 18:26 jotpe It's in the samee plugin called Users
# Aug 15th, 18:26 challgren Are you using a plugin for your Roles?
# Aug 15th, 18:26 jotpe `$this->belongsToMany('Roles', [ 'foreignKey' => 'user_id', 'targetForeignKey' => 'role_id', 'joinTable' => 'roles_users', 'className' => 'Users.Roles' ]);`
# Aug 15th, 18:26 jotpe My UsersTable has this association:
# Aug 15th, 18:25 jotpe I know, it's a silly question, but i don't get the error. I have 3 tables (users, roles and roles_users). roles_users as a join table contains user_id/role_id which has fk to the corresponding table. When i do: `$usersTable = TableRegistry::getTableLocator()->get('Users'); $users = $usersTable->find('all', ['contain' => ['Roles']]);` I get _The Roles association is not defined on Users._
# Aug 15th, 15:25 neon1024 @ndm Thank you for your help. I’ve managed to get my Ajax working *with* the Csrf middleware. In my bluster and confusion I had failed to realize that I needed to call `$this->Form->secure()` and use the values output by that method to pass as my `_Token` data. Thanks again :thumbsup:
# Aug 15th, 15:22 ricksaccous np
# Aug 15th, 15:22 scuadra thank you for the help
# Aug 15th, 15:22 scuadra ok, so I'll try to use it twice and hope it works :slightly_smiling_face:
# Aug 15th, 15:21 ricksaccous yeah you're right, that's what i was saying, that's fine
# Aug 15th, 15:19 scuadra I suggest that I can't see if there are any errors without calling patchEntity :face_with_rolling_eyes:
# Aug 15th, 15:18 ricksaccous meh, whatever that sounds fine
# Aug 15th, 15:17 ricksaccous but that might not be helpful because you can't check for errors there
# Aug 15th, 15:17 ricksaccous you could add the associated data in beforeMarshall possibly
# Aug 15th, 15:16 scuadra I am not sure if I explained what I want to do :