# |
Jun 24th 2019, 18:36 |
joey.mukherjee |
My file is called QueueMovieTask.php and is in /src/Shell/Task. But when I run cake queue, I get "Exception: Task `QueueMovie` not found". My namespace is Queue\Shell\Task, and I have "class QueueMovieTask extends QueueTask {" at the start. Is one of those wrong? |
# |
Jun 24th 2019, 18:22 |
challgren |
Your Task also needs to be named QueueMyCustomJobTask |
# |
Jun 24th 2019, 18:21 |
challgren |
@joey.mukherjee https://github.com/dereuromark/cakephp-queue/tree/master/docs#writing-your-own-task |
# |
Jun 24th 2019, 18:18 |
joey.mukherjee |
Thanks all for your help on my queue issues. I just went with cron and have it checking every minute. Anyway, I made a Queue task using dereuromark/cakephp-queue. However, the only way it works is if I put it in vendor/dereuromark/cakephp-queue/src/Shell/Task. The docs say to put it in src/Shell/Task, but it isn't found if I put it there. Any ideas on what I am doing wrong? |
# |
Jun 24th 2019, 17:23 |
daniel.upshaw |
Thanks @admad |
# |
Jun 24th 2019, 17:21 |
daniel.upshaw |
It's a bit confusing confusing |
# |
Jun 24th 2019, 17:21 |
daniel.upshaw |
I think that does it though |
# |
Jun 24th 2019, 17:21 |
daniel.upshaw |
That works in `beforeRender`, and not in the public method |
# |
Jun 24th 2019, 17:20 |
daniel.upshaw |
Wooot! `$this->RequestHandler->renderAs($this, null);` |
# |
Jun 24th 2019, 17:19 |
admad |
apparently it skips setting the templatepath if you have already set view classname. So try doing that in your action method |
# |
Jun 24th 2019, 17:18 |
daniel.upshaw |
Hmm `_renderType` |
# |
Jun 24th 2019, 17:18 |
admad |
https://github.com/cakephp/cakephp/blob/master/src/Controller/Component/RequestHandlerComponent.php#L631=L639 |
# |
Jun 24th 2019, 17:17 |
daniel.upshaw |
Thank you for the input though, it just isn't taking for some reason |
# |
Jun 24th 2019, 17:17 |
daniel.upshaw |
Ah |
# |
Jun 24th 2019, 17:17 |
admad |
it has nothing to do with view class name |
# |
Jun 24th 2019, 17:14 |
slackebot |
[protected] _vars => [] }``` |
# |
Jun 24th 2019, 17:14 |
daniel.upshaw |
```object(Cake\View\ViewBuilder) { [protected] _templatePath => 'Admin/MenuLinks/ajax' [protected] _template => null [protected] _plugin => null [protected] _theme => 'CoreManager' [protected] _layout => null [protected] _autoLayout => null [protected] _layoutPath => 'ajax' [protected] _name => null [protected] _className => 'App' [protected] _options => [] [protected] _helpers => [ (int) 0 => 'CoreManager.Core' ] |
# |
Jun 24th 2019, 17:14 |
daniel.upshaw |
Wow even if I `$this->viewBuilder()->setClassName('App')` |
# |
Jun 24th 2019, 17:12 |
daniel.upshaw |
Could be `setClassName()` perhaps |
# |
Jun 24th 2019, 17:11 |
daniel.upshaw |
Putting it in `beforeRender()` did at least have an effect.. thanks for the input though, I can keep tinkering with this |
# |
Jun 24th 2019, 17:10 |
daniel.upshaw |
@admad Interestingly, even forcing the path to `$this->viewBuilder()->setTemplatePath('Admin/MenuLinks');`, it adds the `ajax` subfolder to that |
# |
Jun 24th 2019, 17:09 |
daniel.upshaw |
I'll try that to test |
# |
Jun 24th 2019, 17:09 |
daniel.upshaw |
Although then it might be for the whole controller |
# |
Jun 24th 2019, 17:09 |
admad |
beforeRender |
# |
Jun 24th 2019, 17:09 |
daniel.upshaw |
Maybe I need it in a beforeFilter method |
# |
Jun 24th 2019, 17:08 |
daniel.upshaw |
The `debug` call does say `null` |
# |
Jun 24th 2019, 17:08 |
daniel.upshaw |
Also tried an empty string `''`, and double checking `debug($this->viewBuilder()->getTemplatePath());` |
# |
Jun 24th 2019, 17:08 |
daniel.upshaw |
@admad That seems like it would be perfect... did try in the `index()` method setting `$this->viewBuilder()->setTemplatePath(null);` but it still tries to fetch the `ajax` subfolder |
# |
Jun 24th 2019, 16:52 |
admad |
@daniel.upshaw RequestHandler sets the template path to `ajax` subfolder. Use `viewBuilder()->setTemplatePath()` to reset it to `null`. |
# |
Jun 24th 2019, 16:36 |
daniel.upshaw |
What if you want to request the HTML page like the normal route? |
# |
Jun 24th 2019, 16:36 |
daniel.upshaw |
An AJAX call with jQuery.... Cake is requiring a separate `/ajax/index.ctp`, with a layout when it detects an AJAX call |
# |
Jun 24th 2019, 16:35 |
slackebot |
<daniel.upshaw> |
# |
Jun 24th 2019, 16:35 |
daniel.upshaw |
Here's something super annoying |
# |
Jun 24th 2019, 16:17 |
daniel.upshaw |
Lol darn |
# |
Jun 24th 2019, 16:17 |
daniel.upshaw |
Oy |
# |
Jun 24th 2019, 16:17 |
a.didier |
i see... I'm on a really old project and i'm not really used to Cake2 and the previous dev did some weird stuff XD Hard to understand |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/search.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/share.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
`app/View/Recipes/view.ctp` |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
So each of `view`, `share`, `search` generates a response |
# |
Jun 24th 2019, 16:15 |
daniel.upshaw |
```# /app/Controller/RecipesController.php class RecipesController extends AppController { public function view($id) { //action logic goes here.. } public function share($customerId, $recipeId) { //action logic goes here.. } public function search($query) { //action logic goes here.. } }``` |