Hi I have a following Helper created in my bundle:
Edu/AccountBundle/Service/Helper.php
namespace Edu\AccountBundle\Service;
use Doctrine\ODM\MongoDB\DocumentManager;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\Form\Form;
use Edu\AccountBundle\CommonFunctions\CommonFunctions;
class Helper{
private $session;
private $router;
private $documentManager;
private $commonFunctions;
/*
* Class:Constructor
* @DESC:its a very first method which always called whenever this call going to be instantiate
* @param : @session,@route,@db
* @sunilrawat@indivar.com
* @03-06-2016
*/
public function __construct(Session $session, Router $router, DocumentManager $dm)
{
$this->session = $session;
$this->router = $router;
$this->dm = $dm;
$this->commonFunctions = new CommonFunctions();
}
/*
* Class:checkFinancialYearLockPeriod
* @DESC:check a particular date on which accounts Financial Year data will be Locked So that user can not make any modifications after that
* @param : @db
* @sunilrawat@indivar.com
* @03-06-2016
*/
public function checkFinancialYearLockPeriod($dm){
$currentYearIs = $this->commonFunctions()->checkFinancialYear($this->dm);
$exploadsCurrentYear = explode("-",$currentYearIs);
$currentFinancialYearTo = "31-03-".$exploadsCurrentYear[1];
return $effectiveDate = date('d-m-Y', strtotime("+63 days", strtotime($currentFinancialYearTo)));
}
}
//My services.xml code is as following:
<service id="edu.account.helper" class="Edu\AccountBundle\Service\Helper">
<argument type="service" id="session"/>
<argument type="service" id="router"/>
<argument type="service" id="doctrine_mongodb.odm.document_manager"/>
<tag name="twig.helper" />
</service>
//So now I want to call it on Twig directly. So I am calking it as follows:
{{ edu.account.helper.checkFinancialYearLockPeriod() }}
But its not working as throwing following error: "Variable "edu" does not exist".
Please help what is missing in this, Thanks in advance: