Logs for #cakephp

Page 5 of 36,100, showing 100 records out of 3,609,986 total, starting on record 401, ending on 500

# At Username Text
# Apr 18th, 14:44 ricksaccous which woul dbe
# Apr 18th, 14:44 ricksaccous yeah i'm saying in controller you would do $this->viewBuilder->setHelpers() and in the view you would use the other method i think
# Apr 18th, 14:43 this.impetus Sigh, I don't really even understand helpers, sorry. I mean conceptually I do, but I don't havea great concept of cake's architecture. What I *want* to achieve is a means of generating mouse-over thumbnails. The front-end JS stuff is where I am actually qualified. if only one class is going to be using this helper, is it not better to load it in the controller?
# Apr 18th, 14:42 neon1024 `$this->_viewBuilder->setHelpers();` ?
# Apr 18th, 14:41 ricksaccous and you would use a different method to do that
# Apr 18th, 14:41 ricksaccous but yes, it's probably better to add them in the AppView class
# Apr 18th, 14:41 ricksaccous you can add helpers that way
# Apr 18th, 14:41 this.impetus TBH, I *always* try. But I learned PHP years ago, and cake before it implemented namespace stuff, and I often find that I don't quite understand the API.
# Apr 18th, 14:41 neon1024 That’s not where you add helpers.
# Apr 18th, 14:41 ricksaccous lol
# Apr 18th, 14:41 ricksaccous he's using viewBuilder in controller
# Apr 18th, 14:40 neon1024 So the method does exist. Which means you must have a typo I’d imagine
# Apr 18th, 14:40 ricksaccous in your case setHelpers is more appropriate
# Apr 18th, 14:40 ricksaccous learn to use that more often and you'll have less questions in general
# Apr 18th, 14:40 neon1024 AppView::loadHelper has been in for 4 years
# Apr 18th, 14:39 ricksaccous ;)
# Apr 18th, 14:39 ricksaccous @this.impetus https://api.cakephp.org/3.7/class-Cake.View.ViewBuilder.html
# Apr 18th, 14:39 this.impetus ```$this->viewBuilder()->getHelpers(['Thumber.Thumb']);``` seems to have pleased cake
# Apr 18th, 14:39 ricksaccous actually it's best to check the API
# Apr 18th, 14:38 this.impetus yeah, haha. thanks. don't be surprised if I come back
# Apr 18th, 14:38 this.impetus anyway, I should at least try to solve this myself
# Apr 18th, 14:38 ricksaccous you can go through the docs to figure it out
# Apr 18th, 14:38 this.impetus but I keep getting errors stating that `loadHelper` isn't a method
# Apr 18th, 14:38 ricksaccous then figure out what the better method to use is
# Apr 18th, 14:38 ricksaccous hehe
# Apr 18th, 14:37 this.impetus oh? As in now that we know it's there and installed, use the current cake API to actually load it? yeah `->helpers` is deprecated
# Apr 18th, 14:37 ricksaccous is helpers deprecated?
# Apr 18th, 14:37 this.impetus nah I can prolly google that
# Apr 18th, 14:37 ricksaccous don't use the deprecated method would be my advice
# Apr 18th, 14:37 this.impetus And this works. Final question—how do I suppress the deprecation errors?
# Apr 18th, 14:36 this.impetus Ahhhhh
# Apr 18th, 14:36 ricksaccous the second part is the actual name of the helper
# Apr 18th, 14:36 ricksaccous the first part of the string is the plugin namespace
# Apr 18th, 14:36 ricksaccous Thumber.Thumb
# Apr 18th, 14:36 ricksaccous it would be
# Apr 18th, 14:36 ricksaccous so
# Apr 18th, 14:36 ricksaccous I don't think you include the Helper part
# Apr 18th, 14:36 ricksaccous hehehehe
# Apr 18th, 14:36 this.impetus Thumb.Helper or something?
# Apr 18th, 14:35 ricksaccous this is a common theme throughout CakePHP
# Apr 18th, 14:35 ricksaccous when you load a helper from a plugin
# Apr 18th, 14:35 ricksaccous you need to prefix the plugin name
# Apr 18th, 14:35 this.impetus Or rather "Missing Helper" exception thrown
# Apr 18th, 14:35 this.impetus Hunh. Deprecation errors notwithstanding, that line with any of "Thumb", "Thumber", "ThumbHelper", "ThumberHelper" all say the helper is not found.
# Apr 18th, 14:33 ricksaccous $this->viewBuilder()->helpers(['MyHelper']);
# Apr 18th, 14:32 this.impetus `Call to undefined method Cake\View\ViewBuilder::loadHelper()`
# Apr 18th, 14:32 ricksaccous that might work too, lol
# Apr 18th, 14:32 ricksaccous is that a thing?
# Apr 18th, 14:32 ricksaccous can you still set that public helpers array in the controller?
# Apr 18th, 14:32 ricksaccous viewBuilder()
# Apr 18th, 14:31 ricksaccous $this->vieBuilder()->loadHelper or whatever it is
# Apr 18th, 14:31 ricksaccous you could do controller to load the helper but you have to do
# Apr 18th, 14:31 ricksaccous no you would just do that to make sure composer is loading it
# Apr 18th, 14:31 this.impetus Ahh. in the controller works.
# Apr 18th, 14:31 this.impetus In the model's controller, or AppView?
# Apr 18th, 14:30 ricksaccous \Thumber\View\Helper\ThumbHelper
# Apr 18th, 14:29 this.impetus https://github.com/mirko-pagliai/cakephp-thumber
# Apr 18th, 14:29 ricksaccous link me the plugin again
# Apr 18th, 14:29 this.impetus awesome.
# Apr 18th, 14:29 ricksaccous no
# Apr 18th, 14:29 this.impetus @ricksaccous which I assume is some version of `Cake\Use\<something>`?
# Apr 18th, 14:28 this.impetus @neon1024 sure, I'll check it out, jsut started this part of the project, not committed
# Apr 18th, 14:28 ricksaccous first of all to see if anything is available via composer just try loading the namespaced class directly
# Apr 18th, 14:28 neon1024 http://image.intervention.io/
# Apr 18th, 14:27 neon1024 I prefer Intervention image for this kind of thing :slightly_smiling_face:
# Apr 18th, 14:27 ricksaccous lol
# Apr 18th, 14:27 this.impetus (i know because I initially tried haha)
# Apr 18th, 14:27 neon1024 So yeah, as @ricksaccous said
# Apr 18th, 14:27 this.impetus composer won't even install the wrong one :slightly_smiling_face:
# Apr 18th, 14:26 this.impetus yeah I'm on the older versoin of the plugin tho
# Apr 18th, 14:26 neon1024 Well that might be the issue?
# Apr 18th, 14:26 ricksaccous heh
# Apr 18th, 14:26 neon1024 ..but as the latest release of the plugin requires cakephp 3.7.1
# Apr 18th, 14:26 this.impetus 3.6.2
# Apr 18th, 14:26 ricksaccous what version of cake are you on?
# Apr 18th, 14:26 this.impetus *go?
# Apr 18th, 14:26 this.impetus I did not, sorry, I'm a front-end guy learning this stuff; that step wasn't in the instructions. Where does the call to `$this->addPlugin()`
# Apr 18th, 14:26 ricksaccous the old way of doing it...
# Apr 18th, 14:26 neon1024 The plugin provides both methods of loading it seems
# Apr 18th, 14:26 ricksaccous it seems he loaded the plugin via bootstrap
# Apr 18th, 14:26 neon1024 Then in AppView.php use `$this->loadHelper()`
# Apr 18th, 14:25 neon1024 Did you use `$this->addPlugin()` in your Application.php?
# Apr 18th, 14:24 this.impetus And sorry that was a clipboard fail, the error I'm getting is "Helper class ThumberHelper could not be found."
# Apr 18th, 14:23 this.impetus Why might cake fail to find a helper installed via composer?
# Apr 18th, 14:23 this.impetus Well, actually; I did read the instructions wrong, I was placing the call to loadHelper in an individual Controller, not the AppView class. I've done this, now. Plugin instaleld via composer, loaded config/bootstrap. but getting "Plugin::load('Thumber', ['bootstrap' => true, 'routes' => true]);"
# Apr 18th, 14:17 this.impetus please nvm, I read the instructions wrong
# Apr 18th, 14:16 this.impetus morning all you helpful cake enthusiasts. I'm trying to install and use a cake thumbnail plugin, https://github.com/mirko-pagliai/cakephp-thumber. In the CookBook's instructions for using a helper (https://book.cakephp.org/3.0/en/views/helpers.html#configuring-helpers) is a snippet, ```$this->loadHelper('helpername')```, inserted after the ```parent::intitialize()``` line of any controller, but I'm getting ```Call to undefined method
# Apr 18th, 14:16 slackebot App\Controller\ImagesController::loadHelper()```
# Apr 18th, 12:41 admad @mehov sure can
# Apr 18th, 12:41 neon1024 Yeah, you’re right
# Apr 18th, 12:40 admad in fact it would be a pain, you will need `return null` if you don't want to explicitly calls `render()`
# Apr 18th, 12:39 admad there's isnt much practical value
# Apr 18th, 12:38 neon1024 I should think about the value of it really, rather than the code aesthetic
# Apr 18th, 12:38 neon1024 @admad I’ve had to use `return $this->render()` and `): ?Response` but it does work :slightly_smiling_face:
# Apr 18th, 12:31 mehov Hey guys, quick question: can an Entity, that doesn't directly belong to any of the tables, go to src/Model/Entity?
# Apr 18th, 11:38 admad @neon1024 you can add return type hint to your method as required
# Apr 18th, 10:03 neon1024 Would be a nice thing to have imho
# Apr 18th, 10:02 neon1024 With 4.0.0-alpha1 out, how close are we to getting method return types on controller methods?
# Apr 18th, 09:59 dereuromark protected method with bail early
# Apr 18th, 09:58 dereuromark foreach loop from outside IMO