Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Introduction to Propel2 (Symfony Live)

Introduction to Propel2 (Symfony Live)

Propel2 is the upcoming version of the Propel PHP ORM project. This presentation introduces both the Propel's philosophy, and this next major release.

William Durand

June 08, 2012
Tweet

More Decks by William Durand

Other Decks in Programming

Transcript

  1. NO!

  2. ActiveRecord <?php use Acme\Author; use Acme\Book; $author = new Author();

    $author->setFirstname('Andrew'); $author->setLastname('Hunt'); $book = new Book(); $book->setTitle('The Pragmatic Programmer'); $book->setAuthors(array($author)); $book->save();
  3. ActiveQuery (2/2) <?php use Acme\Job; $jobs = JobQuery::create() ->_if(preg_match('/^[A-Z]{2}$/', $location))

    ->filterByCanton($location) ->_else() ->filterByCity($location) ->_endif() ->find(); Smart API for conditions
  4. ActiveQuery (2/2) <?php use Acme\Job; $jobs = JobQuery::create() ->_if(preg_match('/^[A-Z]{2}$/', $location))

    ->filterByCanton($location) ->_else() ->filterByCity($location) ->_endif() ->find(); Smart API for conditions
  5. ActiveQuery (2/2) <?php use Acme\Job; $jobs = JobQuery::create() ->_if(preg_match('/^[A-Z]{2}$/', $location))

    ->filterByCanton($location) ->_else() ->filterByCity($location) ->_endif() ->find(); Smart API for conditions
  6. ActiveQuery (2/2) <?php use Acme\Job; $jobs = JobQuery::create() ->_if(preg_match('/^[A-Z]{2}$/', $location))

    ->filterByCanton($location) ->_else() ->filterByCity($location) ->_endif() ->find(); Smart API for conditions
  7. Aggregate Column Archivable Delegate i18n Nested Set Sluggable Soft Delete

    Timestampable Sortable Versionable Array Access Auditable Auto Add PK Extra Properties Geocodable Publishable Query Cache State Machine ...
  8. <?php use Monolog\Logger; use Monolog\Handler\StreamHandler; $defaultLogger = new Logger('defaultLogger'); $defaultLogger->pushHandler(

    new StreamHandler( '/var/log/propel.log', Logger::WARNING ) ); Propel::getServiceContainer()->setLogger( 'defaultLogger', $defaultLogger );
  9. <?php use Propel\Runtime\Propel; use Propel\Runtime\Connection\ConnectionManagerSingle; $serviceContainer = Propel::getServiceContainer(); $serviceContainer->setAdapterClass( 'bookstore',

    'mysql' ); $manager = new ConnectionManagerSingle(); $manager->setConfiguration(array ( 'dsn' => 'mysql:host=localhost;dbname=my_db', 'user' => 'my_db_user', 'password' => 's3cr3t', )); $serviceContainer->setConnectionManager( 'bookstore', $manager );