Log message #4228026

# At Username Text
# Feb 20th 2020, 17:10 dereuromark I know^^ worst code in general
# Feb 20th 2020, 17:09 kaliel you wan to see a real mess in doc ? try symfony and its annotations :)
# Feb 20th 2020, 17:08 dereuromark doc vs functional part
# Feb 20th 2020, 17:07 dereuromark no, it makes them independant from the source code (and included use).
# Feb 20th 2020, 17:06 phantomwatson It looks like this was added last November to the CakePHP codesniffer ruleset, and I'm _just_ now pulling those changes for some projects and noticing failing tests. Is the rationale that it makes doc comments more human-readable?
# Feb 20th 2020, 16:56 phantomwatson This convention is new to me. I've always seen recommendations to put the fully-qualified names in `use` statements at the top to simplify the rest of your code. PhpStorm kind of nags me with notifications to do that, too. Is there some pitfall to that approach that I've been overlooking?
# Feb 20th 2020, 16:53 dereuromark sure, always use fqcn here
# Feb 20th 2020, 16:53 slackebot Class name \Cake\Mailer\Mailer in @return should be referenced via a fully qualified name.
# Feb 20th 2020, 16:53 phantomwatson Anyone see this PHP codesniffer error before? This code: ```declare(strict_types=1); namespace App\Mailer; use Cake\Mailer\Mailer; class AdminAlertMailer extends Mailer { ... /** * Sets mailer configuration shared by multiple methods in this class * * @param array $data Metadata * @return Mailer */ private function setStandardConfig($data) { ...``` generates this codesniffer violation: >
# Feb 20th 2020, 16:04 spriz In default cake it means something and in that otherwise awesome app template it means something else - rather contradictory I'd say :)
# Feb 20th 2020, 16:04 spriz On another note - is it just me or is this a bit confusing? :) https://github.com/josegonzalez/app/blob/master/src/Controller/AppController.php#L66-L72 vs https://book.cakephp.org/3/en/controllers/components/authentication.html#configuration-options
# Feb 20th 2020, 16:00 sdevore I made a trait for that ;)
# Feb 20th 2020, 15:59 spriz Ah yes, that could work but I'd still have to manually set variables for 'success' and 'data' for the response :S
# Feb 20th 2020, 15:59 sdevore you may be able to use something like that with out the extract step
# Feb 20th 2020, 15:58 sdevore @spriz I have done a trick like this
# Feb 20th 2020, 15:55 spriz I would like to just tap into all existing crud logic about failed saves for an entity with 422 http response code etc
# Feb 20th 2020, 15:54 spriz I could do a Modelless Form AFAIK - but it just seems like a lot of work
# Feb 20th 2020, 15:53 spriz I find myself making controller actions with quite some logic in it if it's for REST API, and I need some other kind of validation than usual - do you guys have some neat tricks here?
# Feb 20th 2020, 13:43 challgren That table extends Tools\Table which extends Shim\Table
# Feb 20th 2020, 13:42 spriz Aha! Never seen that before! :)
# Feb 20th 2020, 13:41 challgren @spriz its the Shim plugin https://github.com/dereuromark/cakephp-shim/blob/master/src/Model/Table/Table.php
# Feb 20th 2020, 13:38 challgren Thats what I was looking for!
# Feb 20th 2020, 13:36 dereuromark https://www.dereuromark.de/2019/12/27/cakephp-and-heroku/ was all we needed to make it work.
# Feb 20th 2020, 13:36 challgren Hmmm from git?
# Feb 20th 2020, 13:35 dereuromark no docker, though. just normal heroku deploy.
# Feb 20th 2020, 13:35 challgren @dereuromark you have your sample docker stuff for building a Heroku deploy?
# Feb 20th 2020, 12:36 tomrwaller Thinking back over my tables/models earlier. I have three tables - [recommendations], [technologies] and [recommendations_technologies]. I want a recommendation to have one 'primary technology' and multiple 'associated technologies'. I thought I could do two associations to technologies on the RecommendationsTable using className but I'm struggling to save the associated technologies. Am I doing this this right?
# Feb 20th 2020, 12:34 spriz @dereuromark No no, I was just surprised that it works in 3.x - I have never seen the syntax before!
# Feb 20th 2020, 12:32 viraj.khatavkar going further, do we have some form of sync method for belongsToMany where in I can pass an array of ids and those are the ones which will be kept in the join table?
# Feb 20th 2020, 11:22 dereuromark I cant do everything on my own.
# Feb 20th 2020, 11:22 dereuromark all fine in 3.x code here. you are free to PR updates though :)
# Feb 20th 2020, 11:21 spriz `$actsAs`
# Feb 20th 2020, 11:21 spriz And this one? :O https://github.com/dereuromark/cakephp-sandbox/blob/master/plugins/Sandbox/src/Model/Table/SandboxPostsTable.php#L33-L36
# Feb 20th 2020, 11:21 spriz what sorcery is this one? :) :) https://github.com/dereuromark/cakephp-sandbox/blob/master/plugins/Sandbox/src/Model/Table/SandboxPostsTable.php#L41-L56 cake 2.x syntax?
# Feb 20th 2020, 11:19 dereuromark hmm, maybe the Tags behavior does this.. : ) ok, then you are probably right.
# Feb 20th 2020, 11:19 spriz Wat! I have had to add the `$this->belongsToMany('Roles')` and `$this->hasMany('UsersRoles')`
# Feb 20th 2020, 11:18 dereuromark you only need the manual one if you want to provide custom table and more logic.
# Feb 20th 2020, 11:18 dereuromark @spriz Shouldnt the HABTM relation auto provide the pivot table? afaik it does
# Feb 20th 2020, 11:18 spriz @viraj.khatavkar you will need to have `$this->hasMany('UsersRoles')` in `UsersTable` :)
# Feb 20th 2020, 11:18 dereuromark Yeah, in my case with tags the pivot table is setup as "tagged" - thus the idehelper added https://github.com/dereuromark/cakephp-sandbox/blob/master/plugins/Sandbox/src/Model/Table/SandboxPostsTable.php#L10-L11 , so $this->Tagged->updateAll() etc then.
# Feb 20th 2020, 11:13 viraj.khatavkar thanks, will see how that goes..