This topic contains 1 reply, has 2 voices, and was last updated by igalayev 6 years, 8 months ago.
- Topic
Hello guys,
I am trying (unsuccessfully) to override a specific class of a bundle.
The class I’d like to override is:Oro\Bundle\MagentoBundle\Entity\Repository\CustomerRepository
To do so, I created my bundle
12345678910namespace Kiwee\Bundle\MnhBundle;use Symfony\Component\HttpKernel\Bundle\Bundle;class MnhMagentoBundle extends Bundle {public function getParent() {return 'OroMagentoBundle';}}And I added the bundles.yml
12bundles:- Kiwee\Bundle\MnhBundle\MnhMagentoBundleSo far, so good.. the bundle is loaded.
Now, it seems I can’t find any working example about how to override the class mentioned above.I tried creating a file with the same relative path as the class I’d like to override, but it doesn’t work.
123456789101112namespace Kiwee\Bundle\MnhBundle\Entity\Repository;use Oro\Bundle\MagentoBundle\Entity\Repository\CustomerRepository as BaseCustomerRepository;class CustomerRepository extends BaseCustomerRepository{public function calculateLifetimeValue(Customer $customer){// [... here is my custom logic for this method ...]}}The first problem I have is that “Customer” is not the same type as in the original class.
The second is that, even fixing it by declaring the full class path, this method is never used while the original is.
Any hint?Thank you very much
The forum ‘OroCRM – Programming Questions’ is closed to new topics and replies.