MillyMonster
MillyMonster

Reputation: 556

SilverStripe and PHP libraries - Why don't they get along?

I'm using SilverStripe 2.4.7 and am trying to use a PHP library that generates QR codes, see here. Now I thought I'd be ok just adding a folder in the mysite/code folder for the PHP code associated with the QR code generator but when I did SilverStripe had a hissy fit, wouldn't let me build the database and displayed this error:

ReflectionException: Class QRCode does not have a constructor

Can anyone explain why this is happening? Thanks

Upvotes: 0

Views: 586

Answers (1)

xeraa
xeraa

Reputation: 10859

SilverStripe tries to autoload all classes. This one seems to miss a constructor...

Put the thirdparty code in its own directory and create a file _manifest_exclude, so it's not autoloaded. You can then load the class with require(), which you normally don't need to do thanks to autoloading ;-)

Upvotes: 4

Related Questions