# |
Apr 30th 2019, 17:48 |
hollistergraham123 |
All of a sudden my cakephp just stopped recognizing new controller methods. Any ideas. |
# |
Apr 30th 2019, 17:40 |
slackebot |
property but it doesn't seem to. Ideas? Basically I'm using `$this->$model->associations()->keys()` to build menus for content management and wish to programatically include, say, `User` and `Posts` associations but exclude associations with models like `ImagesArticles` |
# |
Apr 30th 2019, 17:40 |
this.impetus |
Searching here: https://api.cakephp.org/3.7/class-Cake.ORM.Association.html Trying to determine from an Association Object whether it the associated model has a HABTM relationship with the current model context. A call to `debug()` on an association object reveals a protected property, `_targetTable` that seems to do for making this inference (only HABTM associations seem to populate it); I'd hoped `getTarget()` would access this |
# |
Apr 30th 2019, 16:11 |
this.impetus |
:,) |
# |
Apr 30th 2019, 16:10 |
ricksaccous |
if it weren't for you meddling kids |
# |
Apr 30th 2019, 16:10 |
ricksaccous |
i would have gotten away with it too |
# |
Apr 30th 2019, 16:10 |
this.impetus |
And only a team of unlikely misfits can save me |
# |
Apr 30th 2019, 16:10 |
this.impetus |
Hubris will be my downfall, in the end. |
# |
Apr 30th 2019, 16:10 |
this.impetus |
I've seen this episode. |
# |
Apr 30th 2019, 16:09 |
ricksaccous |
as you keep growing you will achieve super saiyan status |
# |
Apr 30th 2019, 16:09 |
ricksaccous |
and then you grow brain cells and your power increases |
# |
Apr 30th 2019, 16:09 |
this.impetus |
It's silly, I know, but years ago when I learned cake the first time, this was how I did it; do every irritating little thing as cakey as possible, and the logic absorbs |
# |
Apr 30th 2019, 16:08 |
ricksaccous |
lol |
# |
Apr 30th 2019, 16:08 |
ricksaccous |
just create a new helper class and use the trait in it |
# |
Apr 30th 2019, 16:08 |
this.impetus |
Ah! yep. got it. ty and @admad vm |
# |
Apr 30th 2019, 16:08 |
ricksaccous |
and use the helper |
# |
Apr 30th 2019, 16:08 |
ricksaccous |
so basically you want to create a helper |
# |
Apr 30th 2019, 16:07 |
this.impetus |
I get that—so what I *want* is to leverage a single function in the trait in a template file (I could add the trait to the controller and create the ID list before hand I guess..? seems unwieldy?). At this point it'd be easier to just copy and paste it, haha, but it's worth learning to do properly. Again, if anyone's busy ignore this, I'm just being anal |
# |
Apr 30th 2019, 16:05 |
ricksaccous |
@this.impetus you can use the trait in any class |
# |
Apr 30th 2019, 16:03 |
this.impetus |
I can see extending a new View class with the trait, i suppose, but that's extremely overkill for my context |
# |
Apr 30th 2019, 16:01 |
this.impetus |
@admad Ignore this if you're busy, this is a curiosity/learning thing—I'm not sure how, in the context of a view, to utilize the trait you linked. tried `use Cake\View\Helper\IdGeneratorTrait` coupled with `IdGeneratorTrait::_id()` but it's a protected method; is this a PHP-ignorance or Cake-ignorance thing? :P |
# |
Apr 30th 2019, 15:51 |
this.impetus |
@admad ty |
# |
Apr 30th 2019, 15:46 |
charolastra |
hold on, i can load the model and add jobs even if the Plugin isn't loaded; neither in Application.php nor in bootstrap.php? |
# |
Apr 30th 2019, 15:36 |
neon1024 |
That sounds like it’s because Task must implement Queue\Shell\Task\QueueTaskInterface rather than an error with addPlugin |
# |
Apr 30th 2019, 15:33 |
charolastra |
dereuromark: the documentation for Queue talks about Plugin::load(), which is deprecated. so i tried to put Application->addPlugin in bootstrap(). but then the workers fail with "RuntimeException: Task must implement Queue\Shell\Task\QueueTaskInterface" |
# |
Apr 30th 2019, 15:31 |
admad |
@this.impetus https://github.com/cakephp/cakephp/blob/99416723a69e8b8f0c730e1d83cc299800a6fdd3/src/View/Helper/IdGeneratorTrait.php#L52 |
# |
Apr 30th 2019, 15:25 |
this.impetus |
:+1: |
# |
Apr 30th 2019, 15:24 |
ricksaccous |
@this.impetus i'd say don't overthink this and do whatever works for now |
# |
Apr 30th 2019, 15:23 |
slackebot |
generated for form elements. obvs i can just `strtolower(Text::slug()), but is there a way cake wants to do this? |
# |
Apr 30th 2019, 15:23 |
this.impetus |
Soo... it seems like cake, when generating a form field for a database object with a `name` field, uses the hyphenated, **lower case**, version of that field for generating html ids. I can't find a method in either of the Inflector or Text utilities that does precisely this (`Inflector::slug()` does it but is deprecated and `Text:slug()` ignores case. Trying to hook up a JS app here and need my views to generate strings to match the IDs |
# |
Apr 30th 2019, 14:38 |
neothermic |
just 158 more to go |
# |
Apr 30th 2019, 14:38 |
neothermic |
Well, that's one less use of set that I have to change |
# |
Apr 30th 2019, 14:38 |
neon1024 |
Few path updates, few folder and file name changes |
# |
Apr 30th 2019, 14:38 |
neon1024 |
Yeah, 4.0.0-alpha1 wasn’t all that different |
# |
Apr 30th 2019, 14:37 |
dereuromark |
most is method signature and can be automated. not much left. |
# |
Apr 30th 2019, 14:37 |
dereuromark |
nah, 2.x++ was panic. nowadays super simple. |
# |
Apr 30th 2019, 14:37 |
neothermic |
Migrating from 3.x to 4.x: Panic! |
# |
Apr 30th 2019, 14:37 |
dereuromark |
Or more importantly contribute to rector tool to have a full auto-upgrade map there for trivial things. Swarm efforts |
# |
Apr 30th 2019, 14:36 |
dereuromark |
People should start adding notes for 4.x :slightly_smiling_face: |
# |
Apr 30th 2019, 14:35 |
neothermic |
indeed! |
# |
Apr 30th 2019, 14:35 |
admad |
@dereuromark is the patron saint of CakePHP upgrades |