'Symfony 5 select QueryBuilder select object return soft deleted propery
I have object: Shipment with property Supplier of class Company
App\Entity\Shipment id:1234 status:"wait" supplier:Proxies\__CG__\App\Entity\Company
when $qb = $this->createQueryBuilder('s')->select('s');
return shipment object with supplier that soft deleted
why?
I want the object shipment return with supplier: null
I tried to ask if supplier is deleted in shipment class, but did not help
public function getSupplier(): ?Company
{
try {
if (!($this->supplier instanceof Company) || ($this->supplier->isDeleted())) {
return null;
}
} catch (EntityNotFoundException $exception) {
return null;
}
return $this->supplier;
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|