Most of my classes in bundle are having same name. CRMFirstSecondExternal or CRMSecondThirdExternal and so on. Now I need to store the FirstSecond or SecondThird to a $variable and then use that $variable in between the class name to make it a proper call to that class.
use Escalon\Bundle\Admin\CRMBundle\Helper\CRMTravelExpenseExternal;
private function deletePreviousSchedule( $params )
{
$queryParams = array();
$em = $this->getDoctrine()->getManager();
if($params['bundleAndTableName'] == 'EscalonAdminCRMBundle:ClientServiceTe')
{
$helper = 'TravelExpense';
}
//$helper = preg_replace("/[^a-zA-Z]/", "", $helper);
$crmEntityObject = new CRM.$helper.External;
$crmEntityObject -> deletePreviousScheduleExternal($params);
}
Error: Fatal error: Uncaught Error: Class 'Escalon\Bundle\Admin\CRMBundle\Controller\CRM' not found in.