Skip to Content

Propel ORM! Cross the relational bridge to the object-oriented wonders!

Propel is a full-service object persistence and query toolkit for PHP. It allows you to access your database using a set of objects, providing a simple API for storing and querying data. You might already have heard of this technique, but under a different name, like Data Access Objects (DAO) or Object Relational Mapping (ORM). It's a port of Apache Torque (see links section below). // example using business objects $b = new Book(); $b->setTitle("War & Peace"); $b->save(); // "peer" class is static class that handles things like queries $c = new Criteria(); $c->add(BookPeer::TITLE, "War%", Criteria::LIKE); $c->setLimit(10); $books = BookPeer::doSelect($c); foreach($books as $book) { } <?xml version="1.0" encoding="ISO-8859-1"?> <database name="bookstore"> <table name="book"> <column name="book_id" type="INTEGER" required="true" primaryKey="true"/> <column name="title" type="VARCHAR" size="50" required="true" /> </table> </database> </code>


Hello, I decided to try

Hello, I decided to try this framework, because I'm java programmer, so MVC & dependency injection sounds for me really nice. Unfortunately, I haven't found in documentation anything about accessing databases, so I looked at Propel ORM. And this caused problems...

Propel works for me, but not with Lion framework. Well, error said that there are some problems with loading Lion classes. When I'm using Propel setup in index.php...

Code: Select all <?php set_include_path("." . PATH_SEPARATOR . get_include_path()); require_once 'propel/Propel.php'; Propel::init("config/database-conf.php"); include("C:\Programs\Dev\Wamp\www\lion-test\lion\lion.php"); ?>

... I've got Fatal error: Class '__SessionManager' not found in C:\Programs\Dev\Wamp\www\lion-test\lion\libs\startup\ClassLoader.class.php on line 33

When I tried to move Propel initialization to one of the model services (class from lib/model in my application)...

Code: Select all <?php class Test {

function __construct() { require_once 'propel/Propel.php'; Propel::init("config/database-conf.php"); }

function getTest() { return 'test'; } } ?>

...I've got something like that:

Fatal error: Class '__ViewResolver' not found in C:\Programs\Dev\Wamp\www\lion-test\lion\libs\core\actioncontroller\ActionDispatcher.class.php on line 175

Problem is with require_once 'propel/Propel.php'; - without that line my application works well, but I don't have access to ORM

Do you have any idea what should I do? I don't have much practice in php (it was my first language for web, but it was long time ago, before PHP5 etc.), so I hope solution is quite simple...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Dr. Radut | book