Symfony2 uses namespaces,

$api = new \MCAPI('key');

Or, add a use definition to the top of the file,

use MCAPI;



t

On Thu, Dec 9, 2010 at 04:44, Scott Switzer <sc...@switzer.org> wrote:

> Hi -
>
> I am having an issue autoloading a 3rd party vendor class in
> Symfony2.  The class is the Mailchimp API class, which I downloaded
> from the Mailchimp website, and the file is called MCAPI.class.php,
> and the class is called MCAPI.
>
> I renamed the file to MCAPI.php, per the naming standards of autoload,
> and placed the file in the src/vendor/mailchimp/src directory.
>
> In autoload.php, I added the following in registerNamespaces:
>
>
>    'MCAPI'                          => $vendorDir.'/mailchimp/src',
>
> I am unable to get this class to autoload.  When I reference the class
> in my Controller this way:
>
>
>                $api = new MCAPI('my-api-key');
>
> I get the following error:
>
> ( ! ) Fatal error: Class 'Application\MyBundle\Controller\MCAPI' not
> found in /Users/scott/code/domain.com/src/Application/MyBundle/
> Controller/MyController.php on line 28
>
> What it seems to me is that autoload did not work - it was looking for
> the MCAPI class in the current directory, which obviously failed.
>
> I think I am missing something obvious - any help would be
> appreciated!
>
> Cheers,
> Scott
>
> --
> If you want to report a vulnerability issue on symfony, please send it to
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to symfony-users@googlegroups.com
> To unsubscribe from this group, send email to
> symfony-users+unsubscr...@googlegroups.com<symfony-users%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to