akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

AkeneoBatchBundle => BatchCommand: JobInstance class is hardcoded #6159

Closed danielsan80 closed 7 years ago

danielsan80 commented 7 years ago

I'm reporting a Bug

akeneo-pim-system-info_2017-05-12_11-51.txt

This is not properly a bug but a little incoherence in how the code is written. Because of this incoherence you cannot extends the JobInstance model. In fact I could... but I should completely rewrite the BatchCommand.

In the class Akeneo\Bundle\BatchBundle\Command\BatchCommand:82 you can see:

    $jobInstance = $this
        ->getJobManager()
        ->getRepository('Akeneo\Component\Batch\Model\JobInstance')
        ->findOneByCode($code);

As you can see the JobInstance FQCN is hardcoded. As I can see in other files of Akeneo, it should be written in this way:

    $jobInstance = $this
        ->getJobManager()
        ->getRepository(
            $this
                ->getContainer()
                ->getParameter('akeneo_batch.entity.job_instance.class')
        )
        ->findOneByCode($code);

so you can simply redefine the akeneo_batch.entity.job_instance.class parameter with you JobInstance class in your extension bundles.

SamirBoulil commented 7 years ago

See https://github.com/akeneo/pim-community-dev/pull/6161

SamirBoulil commented 7 years ago

Hello and thank you for your bug report and your contribution. The fix you provided has been merged ! :tada:

Don't forget to claim your badge "Core contributor" on http://badger.akeneo.com (if you don't have it ^^).