Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to properly load DoctrineExtensions in Bisna?

I am trying to load some doctrine extensions but I get all sort of errors. So far this is what I have

In my ini:

autoloaderNamespaces[] = "DoctrineExtensions"
resources.doctrine.classLoader.loaderClass = "Doctrine\Common\ClassLoader"
resources.doctrine.classLoader.loaderFile  = "Doctrine/Common/ClassLoader.php"

resources.doctrine.classLoader.loaders.DoctrineExtensions_Paginate.namespace = "DoctrineExtensions\Paginate"
resources.doctrine.classLoader.loaders.DoctrineExtensions_Paginate.includePath = APPLICATION_PATH '/../library/Doctrine/DoctrineExtensions/Paginate/'

And in one of my controllers:

  $count = Paginate::getTotalQueryResults($query); // Step 1
  $paginateQuery = Paginate::getPaginateQuery($query, $offset, $limitPerPage); // Step 2 and 3
  $result = $paginateQuery->getResult();

And this is the error:

Warning: include_once(DoctrineExtensions/Paginate.php): failed to open stream: No such file or directory

like image 947
smorhaim Avatar asked Oct 16 '11 17:10

smorhaim


2 Answers

Try something simple

 //include class loader first

 //make sure this is correct
 $doctrine_root=APPLICATION_PATH. '/../library/Doctrine';

 require_once $doctrine_root.'/Common/ClassLoader.php';

 $classLoader = new \Doctrine\Common\ClassLoader('Doctrine',$doctrine_root);

 $classLoader->register();

 user Doctrine\DoctrineExtensions\Paginate;

Then try reset of the code

  $count = Paginate::getTotalQueryResults($query); // Step 1
  // Step 2 and 3
  $paginateQuery = Paginate::getPaginateQuery($query, $offset, $limitPerPage);  

  $result = $paginateQuery->getResult();

let me know how this works

cheers :)

Note : I haven't tested this code at my end

like image 189
sakhunzai Avatar answered Nov 16 '22 23:11

sakhunzai


I suggest you try this plugin: beberlei / DoctrineExtensions

And here are the details on how to integrate it into your project: README

I do not think you can do so for as the developer has built the extensions! :S

In order to use the autoload for the class Paginate, the class should have been called DoctrineExtensions_Paginate_Paginate.

Good Luck!

like image 3
JellyBelly Avatar answered Nov 17 '22 01:11

JellyBelly