Symfony2 ClassNotFoundException

Я включил набор вспомогательных классов в каталог под названием Model внутри Bundle.

Вот так выглядит основной каталог:

OfflineAnalyticsDev
Source Files
/app
/bin
/app
/src
...
/OfflineAnalytics
/OfflineAnalyticsBundle
/Controller
/DependencyInjection
/Model
...
SugarCrmConnect.php
/Resources
/Tests
...
OfflineAnalyticsOfflineAnalyticsBundle.php
/vendor
/web

Внутри SugarCrmConnect.php у меня есть класс с именем SugarCrmConnect

    namespace OfflineAnalytics\OfflineAnalyticsBundle\Model;

class SugarCrmConnect
{
public static $urlSuffix = "service/v4/soap.php?wsdl";
public static function login($crmHost, $username, $password)
{
...

Я пытаюсь вызвать метод Login из моего DefaultController, но он всегда показывает исключение ClassNotFoundException. Я даже вызываю другие классы из директории Model / пространства имен, которые работают, но этот специально не работает.

namespace OfflineAnalytics\OfflineAnalyticsBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use OfflineAnalytics\OfflineAnalyticsBundle\Model\GoogleAnalyticsHit;
use OfflineAnalytics\OfflineAnalyticsBundle\Model\GoogleAnalyticsUploadService;
use OfflineAnalytics\OfflineAnalyticsBundle\Model\SugarCrmConnect;

class DefaultController extends Controller
{
public function indexAction()
{
$response = new Response();
$hit = new GoogleAnalyticsHit('*******', '******','***', '***','**', '***');
GoogleAnalyticsUploadService::uploadHit($hit);

$loginResult = SugarCrmConnect::login("************", "***",     "***");
return $response->setContent('<html><body><h1>'.$loginResult['id'].'</h1></body>    </html>');
}
}

Я попытался изменить имя файла, чтобы соответствовать имени класса и все, но это все еще не работает.

Вот полное сообщение об ошибке:

Attempted to load class "SugarCrmConnect" from namespace "OfflineAnalytics\OfflineAnalyticsBundle\Model"in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\OfflineAnalyticsDev\src\OfflineAnalytics\OfflineAnalyticsBundle\Controller\DefaultController.php line 19.
Do you need to "use" it from another namespace?

INFO - Matched route "offline_analytics_offline_analytics_homepage" (parameters: "_controller": "OfflineAnalytics\OfflineAnalyticsBundle\Controller\DefaultController::indexAction", "_route": "offline_analytics_offline_analytics_homepage")
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Acme\DemoBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".
EMERGENCY - Class 'OfflineAnalytics\OfflineAnalyticsBundle\Model\SugarCrmConnect' not found
CRITICAL - Uncaught PHP Exception Symfony\Component\Debug\Exception\ClassNotFoundException: "Attempted to load class "SugarCrmConnect" from namespace "OfflineAnalytics\OfflineAnalyticsBundle\Model" in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\OfflineAnalyticsDev\src\OfflineAnalytics\OfflineAnalyticsBundle\Controller\DefaultController.php line 19. Do you need to "use" it from another namespace?" at C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\OfflineAnalyticsDev\src\OfflineAnalytics\OfflineAnalyticsBundle\Controller\DefaultController.php line 19
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ErrorsLoggerListener::injectLogger".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\DebugHandlersListener::configure".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\ProfilerListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\FrameworkBundle\EventListener\SessionListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\FragmentListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\RouterListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\HttpKernel\EventListener\LocaleListener::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Component\Security\Http\Firewall::onKernelRequest".
DEBUG - Notified event "kernel.request" to listener "Symfony\Bundle\AsseticBundle\EventListener\RequestListener::onKernelRequest".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Bundle\FrameworkBundle\DataCollector\RouterDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Acme\DemoBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Symfony\Component\HttpKernel\DataCollector\RequestDataCollector::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ControllerListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\ParamConverterListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\HttpCacheListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\SecurityListener::onKernelController".
DEBUG - Notified event "kernel.controller" to listener "Sensio\Bundle\FrameworkExtraBundle\EventListener\TemplateListener::onKernelController".

Есть идеи?
Я что-то пропустил?

1

Решение

Оказывается, мне пришлось регистрировать свои пространства имен вручную в autoload_classmap.php, расположенном по адресу vendor / composer /

1

Другие решения

Других решений пока нет …

По вопросам рекламы [email protected]