-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PropertyNotSetInConstructor: Property Doctrine\ORM\EntityRepository::$_entityName is not defined in constructor of Repository and in any methods called in the constructor #30
Comments
@weirdan do you have tips how to approach this? Maybe I can create a PR to solve it. |
This solves it: #31 |
@ruudk do you have a self-contained reproducer for this (one that does not rely on your internal classes)? I've seen this error before, but never managed to succinctly reproduce it. As far as I recon it's a Psalm bug, and a way to reproduce would be the first step to fix it there. |
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
use Symfony\Bridge\Doctrine\RegistryInterface;
/**
* @template T
* @template-extends ServiceEntityRepository<T>
*/
abstract class AbstractServiceEntityRepository extends ServiceEntityRepository
{
/**
* @var RegistryInterface
*/
private $registry;
public function __construct(RegistryInterface $registry, string $entityClass)
{
parent::__construct($registry, $entityClass);
$this->registry = $registry;
}
}
class Settlement {}
final class DoctrineSettlementRepository extends AbstractServiceEntityRepository
{
public function __construct(RegistryInterface $registry)
{
parent::__construct($registry, Settlement::class);
}
} Does this work? |
Thanks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this plugin. It removes a lot of false errors from my codebase ❤️
I wonder if we can also fix this error:
code:
The text was updated successfully, but these errors were encountered: