Error with Propel and ZendFramework - php

After inheriting some Zend Framework code it didn't work, after lots of fiddling I've managed to create the schema and rebuild the models, although now I'm getting the following error:
Call to undefined method Criteria::hasSelectClause() in home/richard/library/om/BaseDomainPeer.php on line 329
Why would propel generate files that call unknown methods?

I would think that you have a name collision and you load some other class called Criteria and you don't realize it because of autoloading. Try dumping the methods using get_class_methods()

Turns out the code was built on a system using the beta version of propel, when i forced my system to use the beta version, it worked.
to use the beta version, go here

Related

codeigniter, integrate grocery grud with postgresql

Grocery crud for codeigniter works only with mysql db. To integrate with postgresql recommended to use set_model() to set the model which extends original model and overwrite the functions which gives error.
I did the same, but now it gives me error in grocery_crud.php library file:
Fatal error: Cannot access empty property in D:\xampp\htdocs\ilc\application\libraries\Grocery_CRUD.php on line 1556
I am really confused in this library file, which made we asking you.
I have searched web for solution and alternative ways of integrating this crud with postgresql. but there are almost no solution. somebody change core postgresql driver for codeigniter, which seems not good.
Did somebody solved this issue? Thanks
There is an extension for Grocery CRUD that changes it´s models in order to include all the databases that are supported by Codeigniter (i think this extension uses PDO).
You can download and read more about the extension in the link below
https://github.com/goFrendiAsgard/grocery-crud-databases

How to use the 'raw' PHP Mongodb PECL driver within Symfony2 [duplicate]

This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Using Imagick in Symfony2?
I'm new to Symfony so this might be a dummy question. But since after several hours of google I haven't found any related answer it might worth a try here.
So basically I was using Windows, Apache, pure PHP, Mongodb and the 'raw' PHP_Mongodb PECL driver (the word 'raw' is used here to differ from the Doctrine Mongodb ODM bundle in Symfony2) for web application development. The PECL driver worked perfectly fine, and I could just write something like this:
<?php
$m = new Mongo();
$db = $m->myDB;
$db->find();
//Do Other DB Operations.
The above code worked fine without any 'use', 'include' or 'require' statements since I followed the standard instructions and setup the PECL driver extension in php.ini. When showing phpinfo() in the web browser, the Mongodb driver information shows up correctly. Everything's perfect.
Then I start to use Symfony2 because it provides url rewriting, MVC pattern, security and other useful stuff. The Doctrine Mongodb ODM bundle works nice except that, seems to me, it can only persist PHP objects. I do have a bunch of javascript object in my project to persist and there is simply no way of doing that except to put a 'PHP wrapper' on top of it (to create a PHP object which contains only that javascript object).
When I was trying to use the good old PECL trick to talk to the database with the same block of code above, I got this error:
Fatal error: Class 'MyProject\Controller\Mongo' not found in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\Symfony\src\MyProject\Controller\DefaultController.php on line 47.
Seems Symfony2 blocked or overwrited the extension paths in php.ini while only looking for its auto class loader. I guess I'll need to change the autoload.php and/or AppKernel.php to include that extension? Please help me understand what's going on here. Can I use the PECL driver in Symfony2 at all? Or is Doctrine Mongodb ODM the only way to access database in Symfony2? Thanks!
Symfony2 works with namespace php. This makes working with non-namespace libraries/classes a bit tricky, but you really just need to know the tricks.
When you try to use new Mongo() to grab a mongodb object, PHP looks in your current namespace, which means it looks for a mongo() function within your class. To make this work, you need to specify the namespace for mongo. Since it does not use namespaces, PHP places it in the global namespace . So, to correctly reference the function, you need to use new \Mongo(), and PHP will look in your \ namespace instead of your current one.

Symfony2 seems to break __autoload

I'm currently integrating non symfony2 software (let's call it nsf) in an sf2 project. That software uses __autoload.
When trying to access some nsf features in a twig extension, I get fatal errors about classes not found. It appears that when called from symfony2 code, the __autoload function is not called at all.
I recently moved to php5 so this might sound like a newbie question but I'm trying to figure out what's going on.
Thanks for your clues.
This sounds like a problem originating in the usage of __autoload. If you can, replace those calls with the 'new' spl_autoload_register() call currently adviced:
see: http://php.net/manual/en/language.oop5.autoload.php
spl_autoload_register() provides a more flexible alternative for autoloading classes. For this reason, using __autoload() is discouraged and may be deprecated or removed in the future.
__autoload() is only one function, and is prone to overriding if 2 files want to do something with that. Using spl_autoload_register() means you can register several autoload functions.

How to Unit test CodeIgniter code

I need to do unit testing of CodeIgniter. I tried CIUnit but coulnd't get the fixtures set up in v1.7.2.
I tried pure PHPUnit but could not create stub of model class as it was inheriting active-record and it was throwing error that activerecord not found. Obviously there is no controller which loads the activer record helper.
Is there a way to do unit testing in Codeigniter. I know about simple test library but how good is it when compared to phpunit.
Is there any means to do integration testing also.
FooStack is an add-on that may help you. It includes instructions for fixtures and is compatible with 1.7.2 (which is an old release, BTW).
http://www.knollet.com/foostack/

How to upgrade from Doctrine 1.1.4 to Doctrine 1.2.3 in Zend?

I am trying to upgrade Doctrine in my Zend application. I changed the line in my bootstrap file to point to Doctrine 1.2.3
// Autoload Doctrine ORM
require_once(LIBRARY_PATH.'/Doctrine-1.2.3/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
But I get an error when accessing the application in the browser;
Fatal error: Class 'BaseUser' not found in C:\xampplite\htdocs\SECGearbox\application\models\User.php on line 14.
Seems like the models can't be found.
I'm not quite sure where to proceed from here.
Appreciate the help.
Personally I use the ZFDoctrine integration libraries from beberlei for my Zend Framework 1x and Doctrine 1.2 projects. They provide nice integration between the two and make it easy to use the Zend_Tool command line for Doctrine tasks.
In order to autoload models in Doctrine 1.2 the following line has to be added:
spl_autoload_register(array('Doctrine_Core', 'modelsAutoload'));
This line is added after the two lines I mentioned in my question.

Categories