This is my service file code
adminusercheck.commonFunc:
class: adminBundle\Helpers\CommonFunctions
#arguments: ["@session"]
arguments:
- @doctrine.orm.entity_manager
- @session
This is my Service class code
use Doctrine\ORM\EntityManager;
class CommonFunctions{
private $session;
protected $em;
public function __construct(Session $session, EntityManager $em)
{
$this->session = $session;
$this->em = $em;
}
Your argument order in the constructor
is not matching with what's inside the services file.
The following,
public function __construct(Session $session, EntityManager $em)
Needs to be,
public function __construct(EntityManager $em, Session $session)
It is essential to note that argument order is important.
https://symfony.com/doc/2.8/components/dependency_injection.html
On a separate note, try to keep DI's to the minimum as possible. This will have an impact on performance.
Hope this helps. Thanks.