# |
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 |
# |
Apr 30th 2019, 14:34 |
neothermic |
aha, https://github.com/dereuromark/cakephp-upgrade/wiki/Tips-Upgrading-to-CakePHP-2.x-3.x |
# |
Apr 30th 2019, 14:33 |
neothermic |
hmm, I seem to remember there's a page somewhere with a cheat sheet on going from Set to Hash, but I can't find it |
# |
Apr 30th 2019, 13:54 |
ricksaccous |
@voycey i just add more fields to the group by, heh |
# |
Apr 30th 2019, 13:23 |
charolastra |
right, but running bin/cake CLI stuff doesn't seem to call that method |
# |
Apr 30th 2019, 13:18 |
admad |
https://book.cakephp.org/3.0/en/plugins.html#loading-a-plugin |
# |
Apr 30th 2019, 13:17 |
charolastra |
loading plugins has moved to Application::bootstrap(), right? |
# |
Apr 30th 2019, 11:51 |
dereuromark |
-p PluginName, as usual (and how --help would display) |
# |
Apr 30th 2019, 11:42 |
charolastra |
how to run migrations of plugins? cakephp-queue seems to have changed its DB definitions |
# |
Apr 30th 2019, 11:34 |
conehead |
but thanks! |
# |
Apr 30th 2019, 11:33 |
conehead |
@neon1024 well, using $entity->set seems to work as well. At least seems to be a better solution than setting it directly. Don't wanna convert objects to array data first so it gets converted back afterwards |
# |
Apr 30th 2019, 10:45 |
neon1024 |
Patch entity will work with array data though, but it must be organised correctly |
# |
Apr 30th 2019, 10:44 |
neon1024 |
Unless you’re going to save it |
# |
Apr 30th 2019, 10:44 |
neon1024 |
Although worth noting in the above instance, you might want to set an array of Tag entities |
# |
Apr 30th 2019, 10:44 |
neon1024 |
If you’re setting properties specifically perhaps you’re looking for `$entity->set('tags', $arrayOfTags)` |
# |
Apr 30th 2019, 10:43 |
neon1024 |
@conehead Er, well patchEntity is designed to patch request data into an entity, but it should set properties for anything which matches |
# |
Apr 30th 2019, 10:27 |
conehead |
Or is patchEntity only made for marshalling? |
# |
Apr 30th 2019, 10:24 |
conehead |
Hm...can't I `patchEntity` an object with other objects. e.g. `$this->patchEntity($object, ['tags' => $arrayOfTagObjects])` will not add the desired tags `object->tags = $arrayOfTagObjects` whereas works as desired |
# |
Apr 30th 2019, 10:20 |
charolastra |
cool, solved it :) |
# |
Apr 30th 2019, 10:18 |
neon1024 |
This is the specific line it’s complaining about https://github.com/cakephp/app/blob/master/src/Application.php#L79 |