<?php namespace AppBundle\Model; use Doctrine\ORM\EntityManagerInterface; class CurrencyManager { const NBP_API_URL = 'http://api.nbp.pl/api/exchangerates/rates/{table}/{code}/'; private $em; public function __construct(EntityManagerInterface $em) { $this->em = $em; } }
Jednak robią w kontrolerze
$this->get(CurrencyManager::class)
Dostaję błąd
Kod
You have requested a non-existent service "AppBundle\Model\CurrencyManager".
services.yml:
Kod
parameters:
#parameter_name: value
services:
_defaults:
autowire: true
autoconfigure: true
public: false
AppBundle\:
resource: '../../src/AppBundle/*'
exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
AppBundle\Controller\:
resource: '../../src/AppBundle/Controller'
public: true
tags: ['controller.service_arguments']
#parameter_name: value
services:
_defaults:
autowire: true
autoconfigure: true
public: false
AppBundle\:
resource: '../../src/AppBundle/*'
exclude: '../../src/AppBundle/{Entity,Repository,Tests}'
AppBundle\Controller\:
resource: '../../src/AppBundle/Controller'
public: true
tags: ['controller.service_arguments']