Newbie problem here, I've created a Bundle named MyServices with Sub folder MyBundle,
I've created a Service named myAWServ but as I'm calling $this->get('myAWS')->methodCall() I'm getting the following error :
CRITICAL - Fatal Error: Class 'MyServices\MyBundle\myAWS\myAWS' not found CRITICAL - Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "myAWS" from namespace "MyServices\MyBundle\myAWS". Did you forget a "use" statement for another namespace?" at /home/sergio/Desktop/hello_symfony_heroku/app/cache/dev/appDevDebugProjectContainer.php line 1755
I've reviewed all files a hundred times and can't find the problem the files are as it follow:
<?php
//File Location : MyServices/MyBundle/Controller/myAWS.php
namespace MyServices\MyBundle\myAWS;
class myAWS
{
public function __construct($greeting)
{
$this->greeting = $greeting;
}
public function greet($name)
{
return $this->greeting . ' ' . $name;
}
}
The Root file created with the bundle (php app/console generate:bundle)
//Filesource : MyServices/MyBundle/MyServicesMyBundle.php
<?php
namespace MyServices\MyBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class MyServicesMyBundle extends Bundle
{
}
and the services.yml
parameters:
myAWS.class: MyServices\MyBundle\myAWS\myAWS
services:
myAWSer:
class: "%myAWS.class%"
arguments: [teste]
I've got it loading in the AppKernel new MyServices\MyBundle\MyServicesMyBundle(),
Currently im doing a simple call
<?php
namespace MyServices\MyBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction($name)
{
die($this->get('myAWSer')->greet($name));
}
}
I've also tried clearing the cache. Sorry for the long post, and thank you in advance.
Controllerfraction in the path, but there is no such in the namespace. There is alsomyAWS\myAWS--- it's 2myAWSwhile in the path it's only onemyAWSentry.