The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

can we use propel orm with slim for creating a web service?

shajee's Avatar

shajee

27 Jun, 2012 08:29 AM

Can we use propel orm along with Slim for creating a web service?? when i tried calling slim and propel in single php it doesn't seem to work, please help

  1. Support Staff 1 Posted by Andrew Smith on 27 Jun, 2012 08:36 AM

    Andrew Smith's Avatar

    Yes you can. I can only give you limited help since you only provided limited information. I am not familiar with Propel ORM but you would instantiate it as your would normally do and pass the variable to the $app->get() function.

    $app = new Slim();
    $propel = new Propel();
    
    $app->get('/', function () use ($app, $propel) {
        $data['people'] = $propel->getPeople();
        $app->render('viewname', $data);
    });
    

    that is just an example as I am not familiar with Propel at all.

  2. 2 Posted by Shajee on 27 Jun, 2012 09:10 AM

    Shajee's Avatar

    Propel is not instantiated by creating a class.

    Here is a sample initialization file:

    <?php
    // Include the main Propel script require_once '/path/to/propel/runtime/lib/Propel.php';

    // Initialize Propel with the runtime configuration Propel::init("/path/to/bookstore/build/conf/bookstore-conf.php");

    // Add the generated 'classes' directory to the include path set_include_path("/path/to/bookstore/build/classes" . PATH_SEPARATOR . get_include_path());

    the above is taken from propel documentation.

    BUT STILL, PASSING $app TO THE FUNCTION SEEM TO WORK FOR NOW!
    SLIM IS AWESOME!

    will post if any problems are found as going deep using Slim for creating REST Services with Propel.

  3. Brian Nesbitt closed this discussion on 29 Jun, 2012 01:07 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac