I am using symphony 2, and i m trying to create a custom service container that handle some calculations
my services.yml
services:
my_calculator:
class: my_app\HomeBundle\Services\CalculatorService
arguments: [doctrine]
CalculatorService is as below
<?php
namespace my_app\HomeBundle\Services;
use my_app\CategoryBundle\Entity;
class CalculatorService
{
protected $doctrine;
public function __construct($doctrine)
{
$this->doctrine = $doctrine;
}
public function calculate($data=array())
{
if(!empty($data))
{
}
}
}
my controller function
public function calculateAction()
{
$request = $this->get('request');
$calculator=$this->get('my_calculator');
}
my problem that doctrine object dosen't get get to the constructor
i have tried to arguments: [@doctrine]
and arguments: [@doctrine.orm.entity_manager]
but i get parsing error once i write @
at the yml file
please help