APIProject::createFetch PHP Method

createFetch() protected method

protected createFetch ( ) : SS_HTTPResponse
return SS_HTTPResponse
    protected function createFetch()
    {
        /** @var DNGitFetch $fetch */
        $fetch = DNGitFetch::create();
        $fetch->ProjectID = $this->record->ID;
        $fetch->write();
        $fetch->start();
        $location = Director::absoluteBaseURL() . $this->Link() . '/fetch/' . $fetch->ID;
        $output = array('message' => 'Fetch queued as job ' . $fetch->ResqueToken, 'href' => $location);
        $response = $this->getAPIResponse($output);
        $response->setStatusCode(201);
        $response->addHeader('Location', $location);
        return $response;
    }