Open amici opened 6 years ago
Just came across this issue myself and it caused a lot of confusion until I tracked down the cause. Our choice now is to either ignore the prominent warnings and hints, or use an alternative method of adding new arguments (possibly via a long list of setter methods):
+1 for this issue
Faced same issue. Any updates?
+1 for this issue
I've stopped overriding the constructors for services with a parent, so if I need to add a new dependency I just use a setter method. eg:
services:
aligent.product.processor.custom:
parent: oro.product.processor.core
calls:
- ['setProductRepository', ['@oro_product.repository.product']]
<?php
class AligentCustomProductProcessor extends OroProductProcessor {
protected $productRepository;
// NOTE: No constructor override needed
// Custom setter
public function setProductRepository(ProductRepository $productRepository)
{
$this->productRepository = $productRepository;
}
}
Can get messy if you're injecting a lot of new services, but does reduce a lot of the confusion caused by this specific issue, and less likely to experience breaking changes when Oro decides to add a new dependency to the constructor of the service that you extended (it's happened before, even during minor upgrades).
+1 for this issue
What steps will reproduce the problem?
What is the expected result? As I add new arguments for the child service, I'd expect to see the matching argument hints in editor. So, properly matched hint for 1st, 2nd or any argument.
What happens instead? The argument hints shown for child service show the hints for the parent service instead.
Example shown below:
ParentService class:
ChildService class:
The attached image shows the hints shown in PhpStorm, after those two classes are made.
Thanks!