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

  • SEARCH
  • Home
  • 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 7802461
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T01:16:25+00:00 2026-06-02T01:16:25+00:00

Using cake 2.1.1. I’m trying to make a cron job to execute an action

  • 0

Using cake 2.1.1. I’m trying to make a cron job to execute an action from a controller. Which is right way to do this? I have the OffersController with an action called admin_test. I’d wish to run this action every 2 hours. For the moment I made a shell in app/Console/command/SyncapiShell.php:

class SyncapiShell extends AppShell {
    public $uses = array('Offer');

    public function main() {
       $this->Offer->admin_test();
    }
}

But I get a SQLSTATE[42000] Syntax error or access violation trying to execute the shell.
I’m also using the admin routing, the auth component and ACL. How does the shell work? It ignores the authentication and the acl rights? Normally the admin_test action may be accessed only by specific authenticated users.

Thank you

  • 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-06-02T01:16:27+00:00Added an answer on June 2, 2026 at 1:16 am

    No this is not the right way to do but more likely a strong indicator that your app architecture is not good. You should have fat models and tiny controllers.

    Shell:uses will work like the uses property of a controller and load models. In Controllers you should use the model associations and not load thousands of models using uses.

    Refactor your controller method and move the code into the Offer model.

    LayerCake

    And why does a shell need authentication or admin routing? A shell is, as the name says, a shell program, NOT a website. Authentication is basically done by the OS and user who runs the script. Only people who have access to the shell will have be able to run it anyways.

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

Sidebar

Related Questions

Im trying to make a front page for a website using cake. I want
Is it possible to load a single plugin from outside the cake root using
Im using cake 2.0.6 and im trying to save multiple records that are products
I'm trying to set up 'cake bake' on OS X. I'm using MAMP and
I am confused about how to set this up using Cake's conventions. I have
In my CakePHP application, By using cake.bat i created POT files and by using
You can't have your cake and eat it too, apparently. I'm currently using the
using the jquery ui modal dialog , the background shades grey (i assuming this
Using Ivy with this Ant target: <target name=retrieve-jars> <ivy:retrieve pattern=WebContent/WEB-INF/lib/[artifact].[ext] /> </target> to fetch
I am using cake 1.3 and i had tried to implement favicon..But some strang

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.