Search code examples
symfony1symfony-1.4

Vendor class isn't auto loaded properly


I'm wanting to use the mpdf library with symfony1.4

I have downloaded the library in to lib/vendor/mPDF and I' have updated my autoload.yml file in config/autoload.yml to include the following:

mPDF:
  name:       mPDF
  path:       %SF_LIB_DIR%/vendor/mPDF
  recursive:  on

When I then instantiate the mPDF class,

$mdpf = new mPDF();

I get the following:

Fatal Error: Class 'mPDF' not found

Any ideas?


Solution

  • Your autoload file should be like this :

    autoload:
      mPDF:
        path:      %SF_LIB_DIR%/vendor/mPDF
    

    You must have a first level with autoload.

    By the way, in your case, you just need to load one file, so you don't have to define the recursive: on and the name.