Custom Jobs Problem: Class does not exist

Permalink
Hello I'm trying to add a custom job to the Automated Jobs page for Concrete 5.7

files is called: import_events_from_lamplight.php and is located in /application/jobs/

Code is below.

<?php
  namespace Concrete\Job;
  use \Job as AbstractJob;
  class ImportEventsFromLamplight extends AbstractJob {
    /** Returns the job name.
     * @return string
     */
     public function getJobName() {
        return t('Import events.');
     }
     /** Returns the job description.
     * @return string
     */
     public function getJobDescription() {
        return t('Import events from the lamplight database into concrete5.');


When I go to the jobs schedular page i get the following error.

"Class \Application\Job\ImportEventsFromLamplight does not exist"

Any help or pointers would be appreciated.

dominion79
 
dominion79 replied on at Permalink Reply
dominion79
Ok I got this fixed.

So for anyone who comes across this post here was my solution.

The problem was a name spacing issue, I would recommend reading the Concrete5.7 coding guidelines

http://www.concrete5.org/documentation/developers/5.7/background/co...

For my issue I simply had to add the following namespace

namespace Application\Job;


so my code looks like this.

<?php
  namespace Concrete\Job;
  namespace Application\Job;
  use \Job as AbstractJob;
  class ImportEventsFromLamplight extends AbstractJob {
    /** Returns the job name.
     * @return string
     */
     public function getJobName() {
        return t('Import events.');
     }
     /** Returns the job description.
     * @return string
     */
     public function getJobDescription() {
rodineidias replied on at Permalink Reply
Great man. Thanks very much you sorted my problem.