Log message #4124698

# At Username Text
# Mar 13th, 16:54 neon1024 You need to convert `[ ] >-< [ ]` style ERD into a One to Many, on either side to normalise the Many To Many
# Mar 13th, 16:54 neon1024 You know in a database, what normalisation is right?
# Mar 13th, 16:53 willem what association should i make and where?
# Mar 13th, 16:53 neon1024 You know that in a database you cannot have a Many to Many relationship right?
# Mar 13th, 16:53 willem I read that piece from the docs 100 time, just do not understand it, there is a ApplicantsDe
# Mar 13th, 16:52 neon1024 https://book.cakephp.org/3.0/en/orm/associations.html#using-the-through-option
# Mar 13th, 16:52 neon1024 Just copying and pasting random code from Slack into your project won’t magically make stuff work
# Mar 13th, 16:52 neon1024 You must create the associations
# Mar 13th, 16:52 neon1024 Well of course
# Mar 13th, 16:51 slackebot with ApplicantsDegrees_
# Mar 13th, 16:51 willem if i try your code ``` $test = $this->ApplicantsTable ->find() ->where( [ 'Applicants.id' => '00000000-0000-0000-0000-100000000001', ] ) ->contain( [ 'ApplicantsDegrees' => ['Degrees'], ]) ->first(); ``` i get an error _InvalidArgumentException: Applicants is not associated
# Mar 13th, 16:51 willem not sure what you mean by this ```Your `applicants_degrees` join table has more than foreign keys in, so should really have a table instance```
# Mar 13th, 16:47 neon1024 Making your join more verbose `$this->Applicants->find()->contain(['ApplicantsDegrees' => ['Degrees']])`
# Mar 13th, 16:47 neon1024 Your `applicants_degrees` join table has more than foreign keys in, so should really have a table instance
# Mar 13th, 16:46 neon1024 As you want to store data in the join
# Mar 13th, 16:46 neon1024 @willem They’re right that you need a join table instance
# Mar 13th, 16:42 willem could anybody with good knowledge of join tables please help me with this: https://discourse.cakephp.org/t/trying-to-get-additional-data-using-belongstomany-with-multiple-tables/3699 The find does not show the data from other tables using the find. Maybe it should be called differently but i just cannot get this working.
# Mar 13th, 16:35 xinobi dereuromark however it is not possible with the current database and I'm not sure how deep I need to go to fix this
# Mar 13th, 16:33 dereuromark then there is no problem :slightly_smiling_face:
# Mar 13th, 16:33 xinobi dereuromark exactly
# Mar 13th, 16:32 dereuromark there should only be one table, but different roles and additional data etc linked to this.
# Mar 13th, 16:31 dereuromark xinobi: what you want is usually not a good design.
# Mar 13th, 16:30 jeremyharris e.g., override FormAuthenticate::authenticate to iterate through your tables, setting the config userModel and just reusing the default _findUser method
# Mar 13th, 16:29 jeremyharris not the component, but the Authenticate object. that’s where you want to look. Look at FormAuthenticate (or whatever base authenticator you’re using) and extend that to fit your needs
# Mar 13th, 16:28 xinobi jeremyharris I need to pass an array of models... but the base auth component only supports a string so I guess I would need to implement my own component yes
# Mar 13th, 16:26 jeremyharris xinobi you can create additional authenticators that extend the authenticator you’re using (e.g. Form) and add it to your authenticate array, with configuration per-authenticator. For example, create a CustomAuthenticate extends FormAuthenticate, then configure it in the auth component with the different userModel
# Mar 13th, 16:19 xinobi does the auth component support multiple model? I need to authenticate users from different tables
# Mar 13th, 16:00 savant You can invite someone to the CakePHP slack via the invite app: http://cakesf.herokuapp.com/
# Mar 13th, 16:00 savant @ankitgsolanki why did you unpin that?
# Mar 13th, 15:39 dereuromark just debug() the env() part in bootstrap and see/find out.
# Mar 13th, 15:39 greenjam94 ``` /** * Debug Level: * * Production Mode: * false: No error messages, errors, or warnings shown. * * Development Mode: * true: Errors and warnings shown. */ 'debug' => true, ``` But all I see on the page is: `An Internal Server Error Occurred`
# Mar 13th, 15:38 dereuromark depends on your env config
# Mar 13th, 15:38 greenjam94 debugging or not..
# Mar 13th, 15:38 dereuromark the config file? not really.
# Mar 13th, 15:37 greenjam94 gotcha, thanks.. any chance it’s cacheable?
# Mar 13th, 15:37 dereuromark See https://github.com/cakephp/app/blob/master/config/app.default.php#L12 env() part
# Mar 13th, 15:37 dereuromark it can also come from env :slightly_smiling_face:
# Mar 13th, 15:30 greenjam94 also, it’s a test server, nothing in production
# Mar 13th, 15:29 greenjam94 not in version control, it’s something i’m directly changing on the server.. I just don’t see it taking affect
# Mar 13th, 15:26 dereuromark this will then not be shipped (or accidentally deployed) to production
# Mar 13th, 15:26 dereuromark instead in the local file (I call mine app_local.php) you can then overwrite it locally to true