Log message #4200401

# At Username Text
# Aug 29th 2019, 13:36 neon1024 Just increment the version and duplicate the whole thing
# Aug 29th 2019, 13:36 neon1024 I thought it would be easier with Duplicatable
# Aug 29th 2019, 13:35 admad they are both José, but the author of that version plugin is savant not lorenzo
# Aug 29th 2019, 13:35 neon1024 Did I? Oh geez, so I did. Apologies José I meant Jose
# Aug 29th 2019, 13:34 admad you got the wrong Jose :slightly_smiling_face:
# Aug 29th 2019, 13:34 neon1024 Any advantages to storing the versions in other tables? Why wouldn’t you just version in the same table?
# Aug 29th 2019, 13:34 lorenzo I'm not @savant
# Aug 29th 2019, 13:33 neon1024 Anyone know if @lorenzo https://github.com/josegonzalez/cakephp-version plugins supports associations? Or if I’d need to hook the event and persist the associations manually
# Aug 29th 2019, 13:29 slackebot2 !awesome
# Aug 29th 2019, 13:29 slackebot2 Command sent from Slack by neon1024:
# Aug 29th 2019, 13:29 neon1024 I need to add versioning to a stack in my application. Does anyone have a plugin for this? To detect changes across all associations and then duplicate with incremented version
# Aug 29th 2019, 13:15 alexdd55976 Authentification with LDAP credentials through the Authentification Component did not work as expected... but a neat workaround helped me getting the result into Authentication Component for further validation :partyparrot:
# Aug 29th 2019, 13:00 dereuromark jep jep, prg etc
# Aug 29th 2019, 12:59 ricksaccous if it doesn't happen successfully they are on the same page but cake magic will allow the errors to show up
# Aug 29th 2019, 12:59 ricksaccous basically i only redirect if the save happens successfully
# Aug 29th 2019, 11:58 dereuromark The redirect is bad if you work with forms, as you lose the inputted data on form validation. Otherwise also redirecting would not be a too big issue if you want to go that way.
# Aug 29th 2019, 11:43 davorminchorov ok an else statement without the redirect fixed the issue I had, thanks for the help!
# Aug 29th 2019, 11:39 davorminchorov Ok so that's the difference compared to how I used to do it in the past projects with Laravel for example, where each action is a different controller method. So should i use an else statement in my case without redirecting?
# Aug 29th 2019, 11:38 alexdd55976 actually its what is generated through bake on forms
# Aug 29th 2019, 11:37 alexdd55976 this is pretty much standard
# Aug 29th 2019, 11:36 davorminchorov Maybe it is because the same action is being used for GET and POST / PUT / DELETE actions
# Aug 29th 2019, 11:34 alexdd55976 this seems kind of pointless to me
# Aug 29th 2019, 11:33 davorminchorov that's why I try to redirect the user to the same page
# Aug 29th 2019, 11:33 davorminchorov @alexdd55976 Yeah but I wanna stop the code from executing further instead of having an else statement
# Aug 29th 2019, 11:25 alexdd55976 it seems that the user is not authenticated.. maybe there is some need of different wording.. at least for me it seems very confusing
# Aug 29th 2019, 11:24 ndm *false
# Aug 29th 2019, 11:24 ndm or that the identity is `fasle`-ish
# Aug 29th 2019, 11:24 ndm It depends on where exactly the exception is thrown, if it's thrown from the component, then it means that the authentication middleware didn't run, because the `identity` attribute on the request is missing.
# Aug 29th 2019, 11:22 alexdd55976 oh.. or does it mean: everything works, but user is not authenticated?
# Aug 29th 2019, 11:21 alexdd55976 @ndm i do this ` $this->loadComponent("Authentication.Authentication");` but get the message `Authentication is required to continue`
# Aug 29th 2019, 11:18 alexdd55976 so, actually you are already there
# Aug 29th 2019, 11:18 slackebot2 self-containing. As mentioned, `$this->Authentication` refers to the authentication component, it's initialized via `Controller::loadComponent()`. https://book.cakephp.org/authentication/1.1/en/index.html#authentication-component
# Aug 29th 2019, 11:18 ndm @alexdd55976 `$request` comes from wherever it is intended to come from depending on the context where your code runs, in a middleware it's passed to the `__invoke()` method, in controllers and views there's the `getRequest()` method, in components you can retrieve it via the the controller that the component is attached to... The examples in the documentation often rely a bit on a certain familiarity with the framework, and aren't neccesarily
# Aug 29th 2019, 11:18 alexdd55976 if you do no submitting to a different action, you stay in that action
# Aug 29th 2019, 11:16 davorminchorov hmm, that's a good point, did not think of it. What's a good way to get back on the same page?
# Aug 29th 2019, 11:15 alexdd55976 why you redirect? isn't that clearing the variables?
# Aug 29th 2019, 11:14 slackebot2 ($numberOfValidationErrors > 0) { $this->set('transitionValidationErrors', $transitionValidationErrors); return $this->redirect($this->referer()); } ```
# Aug 29th 2019, 11:14 davorminchorov @alexdd55976 This is what I do: ``` $people = $this->Persons->newEntities($preparedTransitionsData); $people = $this->Persons->patchEntities($people, $preparedTransitionsData, [ 'validate' => 'add' ]); $numberOfValidationErrors = 0; $transitionValidationErrors = []; foreach($people as $key => $person) { $numberOfValidationErrors += count($person->getErrors()); $transitionValidationErrors[$key] = $person->getErrors(); } if
# Aug 29th 2019, 11:09 alexdd55976 you can use this as a example
# Aug 29th 2019, 11:08 alexdd55976 this is what i do with manuel validation
# Aug 29th 2019, 11:08 slackebot2 'missing key: ends_time (format: HH:MM:SS)'); $errors = []; if ($validator->errors($this->request->getData()) != null) { $errors = array_merge($errors, $this->restructureValidationMessages($validator->errors($data))); } ```