Dezigo
Dezigo

Reputation: 3256

symfony2 service extends another class

I had written the class service before I received the new task. I need to expand my service..

I had:

namespace Trucking\MainBundle\Service;
use Trucking\MainBundle\classes\Scan;

    class ScanService  {

        public function scan() { 
          // code
        }
    }

I've upgraded the service

namespace Trucking\MainBundle\Service;
use Trucking\MainBundle\classes\Scan;

class ScanService extends Scan\Process\Process  {

    public function scan(Scan\IScanVirtual $virtual) { 
        $virtual->start($this);
    }
}

Services.yml

scan_storage:
  class : Trucking\MainBundle\Service\ScanService
  arguments: [path,container,movetime,checkpoint]

I have an error :

message":"Runtime Notice: Declaration of Trucking\MainBundle\Service
\ScanService::scan() should be compatible with that of

Trucking\MainBundle\classes\Scan\Process\Process::scan() in C:\webserver\symfony\src\Trucking\MainBundle\Service
\ScanService.php line 11","class":"ErrorException","trace":[{"namespace":"","short_class":"","class":"","type":"","function":"","

ScanService.php line 11:

ScanService extends Scan\Process\Process

Upvotes: 0

Views: 969

Answers (1)

gremo
gremo

Reputation: 48477

scan() in ScanService has a different number of argument of Process (or a different access level). This is pure PHP and has nothing to do with Symfony.

Upvotes: 4

Related Questions