I get the following error from Laravel 4.1.
ReflectionException Class Acme\Services\TaskCreatorService does not exist.
Thanks in advance for any help.
Below is the code defining the class. It is found in app\Acme\Services.
<?php namespace Acme\Services;
use \Acme\Validators\TaskValidator;
use \Acme\Validators\ValidationException;
use \Acme\Validators\Validator;
class TaskCreatorService {
protected $validator;
public function __construct(TaskValidator $validator) {
$this->validator = $validator;
}
public function make(array $attributes) {
//determone whether data is valid
if ($this->validator->isValid($attributes)) {
Task::create([
'title' => $attributes['title'],
'body' => $attributes['body'],
'user_id' => $attributes['assign']
]);
return true;
}
throw new ValidationException('Task validation failed', $this->validator-getErrors());
//create the new task
//
//if not throw exception
}
}
I have also add this to composer.json in the autoload section.
"psr-0": {
"Acme": "app/"
}
composer dump-autoloadin general when using PSR-0/4, you will need to do it the first time you edit thecomposer.jsonfile to specify this, just so that Composer actually knows about this PSR rule. Is that the issue here?