0

Below is my shell class

FriendShell.php

require_once 'AppShell.php';

class FriendShell extends AppShell
{
      //code
}

AppShell.php

App::uses('Shell', 'Console');

class AppShell extends Shell {
    public function perform() {
        $this->initialize();
        $this->{array_shift($this->args)}();
    }
}

Reference to issue on

https://github.com/kamisama/Cake-Resque/issues/25

I removed

App::uses('AppShell', 'Console/Command');

and now using

require_once 'AppShell.php';

in FriendShell.php

But problem still remains because AppShell.php using

App::uses('Shell', 'Console');

That's why I am getting error Class 'App' not found when trying to run that shell.

Any help appreciated

Thank you

4
  • I don't think that's why you're getting that error. AppShell is a vendor package. Try this App::uses('AppShell','Vendor/Shells');. Also App would be undefined if you start the shell incorrectly. Commented Sep 30, 2013 at 11:42
  • @MathewFoscarini Thanks for response,I tried you suggestion but still giving same error. Commented Sep 30, 2013 at 12:11
  • @MathewFoscarini,Let me clear scenario,currently I am in app directory 'php Console/Command/FriendShell.php' and executing this command.Is any problem with this? Commented Sep 30, 2013 at 12:13
  • 1
    No that's not how you execute a shell. Take a look at this. book.cakephp.org/2.0/en/… Commented Sep 30, 2013 at 12:19

1 Answer 1

1

Working with

Console/cake 

It is CakeResque plugin and FriendShell.php is a job class therefore whole command is look like this now

Console/cake CakeResque.CakeResque enqueue default Friend "swapnil"
Sign up to request clarification or add additional context in comments.

2 Comments

And it should also be noted, that require_once 'AppShell.php'; is nonsense. What there was before was correct (the App::uses() statement).
@mark,Ok got it now but I did due to that same issue link.Thanks for your response

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.