this is the mailing list about developping symfony2, so not really the
right place for this kind of questions. you should use the
symfo...@googlegroups.com list for such questions.

> Hi, I'm trying to create an utility class (inside a generic Utility
> subdirectory of my bundle) to implement some features, but I don't
> understand how autoload works.
> I'm using Symfony 2.1.

autoload is according to PSR 0. if you set up your project correctly, it
will work if namespaces translate to folder names.

i.e. your util class is

Acme\DemoBundle\Helper\Util

then it should live in src/Acme/DemoBundle/Helper/Util.php and start like
<?php
namespace Acme\DemoBundle\Helper;

class Util
{
    // ...
}

and the code using it does

<?php
use Acme\DemoBundle\Helper\Util;

Util::myStaticFunction();
// or
$util = new Util(); // if you do this, read up on dependency injection
// to reduce hard dependencies in your code
// http://symfony.com/doc/current/book/service_container.html

cheers,david

-- 
-- 
If you want to report a vulnerability issue on Symfony, please read the 
procedure on http://symfony.com/security

You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Symfony developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to symfony-devs+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to