Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Working with the cli


Go to End


791 Views

Avatar
Rudiger

Community Member, 8 Posts

2 April 2016 at 5:20pm

Edited: 02/04/2016 5:22pm

I'm trying to get a task running that I have created in mysite/tasks. When I try to run the cli like:

php framework/cli-script.php ImporterTask

with this code:

class ImporterTask extends HourlyTask
{
    function process() {
        $page = new Page;

        $page->Title = 'cron';
        $page->MenuTitle = 'cron';
        $page->Content = 'this is some test content';
        $page->URLSegment = 'test';
        $page->Status = 'Published';
        $page->doRestoreToStage();

        $page->write();
    }
}

It throws the error:

Uncaught Exception: Object->__call(): the method 'setowner' does not exist on 'ImporterTask'
IN GET ./FranchiseImporterTask

There is nothing I can find that the class needs a setowner function and when I put it in it throws the error:

ERROR [User Error]: Uncaught SS_DatabaseException: Couldn't run query:

INSERT INTO "SiteTree" ("ID") VALUES ($1)

Though I might not be returning the right thing for it.