Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7431351
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:16:55+00:00 2026-05-29T09:16:55+00:00

I am trying to implement a task using the cakephp shell for my application.

  • 0

I am trying to implement a task using the cakephp shell for my application. The task involves running a long running process (hence the need to use the shell).

The function requires me to use a function inside a Component called CommonComponent

Unfortunately whenever i try to include the component i get the following error
PHP Fatal error: Class ‘Component’ not found in /var/www/nginx-test/app/Controller/Component/CommonComponent.php

Here is the CronShell Class which is being called

class CronShell extends AppShell {
   public function main() {
        $this->out('Hello world.');      
//  $this->out(phpinfo());
    }
     public function test()
    {
         $this->out('Before Import'); 
        App::import('Component', 'Common');
        $this->out('Import complete');
        // $this->Common=ClassRegistry::init('CommonComponent');
        $this->Common =new CommonComponent();
        $this->out('Initialization complete');
        $this->Common->testCron();
         $this->out('FunctionCall complete');
        //$this->Common->saveCacheEntry("name","value");
    }
    }

The CommonComponent class is stored as app/Controller/Component/CommonComponent.php and is as follows

 class CommonComponent extends Component
{
 function testCron()
    {    
     $this->out('Hello world from Component.');
    }
 }

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T09:16:56+00:00Added an answer on May 29, 2026 at 9:16 am

    What you import into the Shell should be code from within your Apps Lib

    the component can also make use of the Lib code – but you’ll not need to do a load of tedious stuff
    if you set it up right you’ll make you app cleaner

    if you import the component you’ll need to pass it a component collection and so you’d have to make that from witin shell not that your use it (or if you do you must be doing it wrong)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to implement a thread pool that processes a task queue using
trying to implement a dialog-box style behaviour using a separate div section with all
I'm trying to implement a cancellable worker thread using the new threading constructs in
I am trying to implement Factorial function via divide and conquer strategy. I used
I am trying a simple application using NSArrayController and cocoa bindings. The application contains
I am trying to implement a Silverlight 2 client application that takes data from
I'm trying to implement an API that performs some really lengthy tasks using a
I'm trying to implement this (Configuring Sockets for VoIP Usage) using this (CocoaAsyncSocket). To
I'm trying to implement a list using the ListView, which contains rows built with
I'm trying to implement a simple queue that performs one task at a time.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.