Commit 9ca3cbb4 authored by Emiliano Balbuena's avatar Emiliano Balbuena

(fix): Circular DI issue on Entities\Resolver

1 merge request!235WIP: Boost Campaigns (&24)
Pipeline #71975138 passed with stages
in 8 minutes and 34 seconds
......@@ -15,21 +15,15 @@ use Minds\Core\Entities\Resolver;
class BoostCampaignResolverDelegate implements ResolverDelegate
{
/** @var Manager */
protected $manager;
/** @var Resolver */
protected $resolver;
/**
* BoostCampaignResolverDelegate constructor.
* @param Manager $manager
*/
public function __construct(
$manager = null
)
public function __construct()
{
$this->manager = $manager ?: Di::_()->get('Boost\Campaigns\Manager');
// NOTE: Campaigns\Manager is injected dynamically because of circular dependency issues
}
/**
......@@ -59,11 +53,14 @@ class BoostCampaignResolverDelegate implements ResolverDelegate
*/
public function resolve(array $urns, array $opts = [])
{
/** @var Manager $manager */
$manager = Di::_()->get('Boost\Campaigns\Manager');
$entities = [];
foreach ($urns as $urn) {
/** @var Campaign $boost */
$boost = $this->manager->get($urn);
$boost = $manager->get($urn);
$entities[] = $boost;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment