N
N
Nikita Harlov2014-04-29 08:58:49
symfony
Nikita Harlov, 2014-04-29 08:58:49

Symfony2 - why is the service not loaded from bundl-a subdirectories?

Trying to define a service in Symfony2:
services.yml

parameters:
    h.user_provider.class: Harlov\DelivBundle\HUserProvider
    h.rest.class: Harlov\DelivBundle\Services\HRest
    h.rest.backend_ip: 192.168.0.102
services:
    h_rest:
        class: %h.rest.class%
        arguments: [%h.rest.backend_ip%,@serializer,@buzz]

Hrest.php
<?php

namespace Harlov\DelivBundle\Services;

class HRest { ... }

With this definition, I get an error:
ClassNotFoundException: Attempted to load class "HRest" from namespace "Harlov\DelivBundle\Services" in /var/www/deliv/app/cache/dev/appDevDebugProjectContainer.php line 3176. Do you need to "use" it from another namespace?

But if you move the service to the root of the bundle, everything works correctly.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikita Harlov, 2014-04-29
@harlov91

Problem solved. There were no write permissions for directories created by nfs from outside. Because of this, symphony cannot load these classes.

V
Vyacheslav Slinko, 2014-04-29
@KeepYourMind

I suspect that you may have problems with file paths.
Does it work ls src/Harlov/DelivBundle/Services/HRest.php?

N
Nikita Gusakov, 2014-04-29
@hell0w0rd

Show autoload fromcomposer.json

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question