i'm new to symfony2 and getting hard time to inject services into my custom class. Following is the Scenario: In Bundle, i created a folder and a class inside it. In that bundle, services.yml has the following code
parameters:
rc2ab_model.class: rc2ab\ShareBundle\Model\Rc2abModel
services:
rc2ab_model:
class: "%rc2ab_model.class%"
arguments: ["@doctrine.orm.entity_manager"]
This is the constructor of the custom class
public function __construct($em) {
}
After this when i create Object of Rc2abModel Class in DefaultController
$myObj = new Rc2abModel();
Error comes:
Warning: Missing argument 1 for rc2ab\ShareBundle\Model\Rc2abModel::__construct(), called in Default Controller....
I am not able to fix this out, i have read the documentation on their site, so please don't give me documentation link, i have tried other solution here but nothing seems to work for me. Kindly suggest.