-
Notifications
You must be signed in to change notification settings - Fork 112
Closed
Description
In a nutshell, this PHP class:
use Doctrine\ORM\Decorator\EntityManagerDecorator;
use PowerDNSBundle\Doctrine\ORM\PowerDNSEntityManager;
use PowerDNSBundle\Entity\PowerDNSDomain;
class DnsManager extends EntityManagerDecorator
{
/**
* @var ObjectRepository
*/
private $domainRepository;
public function __construct(PowerDNSEntityManager $wrapped)
{
parent::__construct($wrapped);
$this->domainRepository = $this->getRepository(PowerDNSDomain::class);
}
public function addDomainIfNotExists($name, User $user, $ipV4 = null, $ipV6 = null, $checkDNS = true)
{
$nameCanonical = \idn_to_ascii($name);
$domain = $this->domainRepository->findOneBy(['name' => $nameCanonical]);
if (!$domain) {
$domain = new PowerDNSDomain();
$domain->setName($name);
$domain->setOwnerId($user->getId());
$this->saveDomain($domain, $ipV4, $ipV6, $checkDNS);
}
return $domain;
}
}Produces:
------ ----------------------------------------------------------------------
Line src/AppBundle/Manager/DnsManager.php
------ ----------------------------------------------------------------------
170 Method AppBundle\Manager\DnsManager::addDomainIfNotExists() should
return PowerDNSBundle\Entity\PowerDNSDomain but returns object.
Replacing the line by $domain = $this->getRepository(PowerDNSDomain::class)->findOneBy(['name' => $nameCanonical]); directly "solve" the issue.
It seems the property assignation of repositories is not handled by the extension.
Metadata
Metadata
Assignees
Labels
No labels