Skip to content

Instantly share code, notes, and snippets.

@r8or0pz
Created December 25, 2018 12:07
Show Gist options
  • Save r8or0pz/66fd0c0d025af64176c59632725e28d2 to your computer and use it in GitHub Desktop.
Save r8or0pz/66fd0c0d025af64176c59632725e28d2 to your computer and use it in GitHub Desktop.
<?php
namespace Controller;
use Symfony\Component\HttpFoundation\Request;
class FooController
{
public function doSomething(Request $request, AwesomeService $service)
{
return $service->foo();
}
}
class AwesomeService
{
private $barService;
public function __construct(BarService $barService)
{
// args are available here
$args = $something->getData();
$this->barService = $barService;
}
public function foo()
{
// doSomething is dependant on args
$args = $this->barService->doSomething();
}
}
class BarService
{
/**
* This is where the problem is
* @param BarService $barService [description]
*/
public function __construct(array $args)
{
// ../
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment