Hi I have a class name "Customer" in a variable like:
$myclass = "Customer";
Now I have created object for this class at run time inside a service file:
namespace MyBundle\Service;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\QueryBuilder;
use MyBundle\Component\Data\handle\Customer;
use Symfony\Component\HttpFoundation\Request;
class MyServices
{
private $em;
public function __construct(EntityManager $entityManager)
{
$this->em = $entityManager;
}
public function getClassCustomer($className)
{
$object = new $className();
}
}
Now I am getting following error:
Attempted to load class "Customer" from the global namespace
Even Customer class is already defined and included in the same file:
Please suggest what could be the Issue. thanks in advance
use/BundleName/ClassFolder:is not including anything.