I have strange problem with symfony2. In service.yml I declared pagination service:
site.paginate_service:
class: "Smestaj\SiteBundle\Services\PaginationService"
arguments:
- "@service_container"
Service looks like this:
namespace Smestaj\SiteBundle\Services;
use Symfony\Component\DependencyInjection\ContainerInterface;
class PaginationService{
protected $cn;
protected $numberOfData;
public function __construct(ContainerInterface $container)
{
$this->cn = $container;
$this->numberOfData = $container->getParameter("limit")['adsPerPage'];
}
Problem is when I call this service in service.yml into another service as dependacy injection
site.ads_service:
class: "Smestaj\SiteBundle\Services\AdsService"
arguments:
- "@doctrine.orm.entity_manager"
- "@service_container"
calls:
- [setPaginate, ["@site.paginate_service"]]
then I get this error message:
Attempted to load class "Services aginationService" from namespace "Smestaj\SiteBundle". Did you forget a "use" statement for another namespace?
So, from this message it's clearly that symfony trying to call class "ServicesaginationService". My class has Smestaj\SiteBundle\Services\PaginationService. Symfony, somehow merge Services and PaginationService name, and remove "P" from name.
If I Change Class name to AaaService then everything works fine.
classvalues.