Search code examples
phpnamespacesdoctrine-ormautoloader

Exempt one or more class by a Namespace autoloader


I am using in a project phpQuery for parsing HTML and Doctrine2 for DB persistence.

Doctrine 2 uses an autoloader strategy based on namespaces, so f.e. when calling a \Doctrine\Orm\EntityManager it goes inside DoctrineDir__/Doctrine/Orm/EntityManager.php loading relative class.

The problem is that phpQuery is a complex library that I need to scrape some HTML necessary for my project, and it's not namespaced.

I have tried namespacing it, but the phpquery doesn't work, giving me no error.

So what I am asking is there any code that can makes me exclude some classes from the autoloading strategy in anyway?

THanks


Solution

  • Also if that seemed very strange, I have solved the problem simply including the file as normal after the declaration of Entity Manager and all scripts.

    Latest time didn't work, but this time yes. Strange!

    Edit: it works probably only on procedural style php code, probably inside some objects it may give any problem.