Learning PROPEL in 30min

Translation of the original in Catalan. Read it in: CatalàCastellano

Propel is a PHP framework that lets you access databases using objects; it offers us a very simple API that is able to filter the queries against the database so that they are completely transparent to our application. So we understand each other, we're talking about things you surely know such as DAO or ORM.

grafic-propel.gif

To get an idea, to define the structure of a database you only need to write an XML file with the fields of the tables, types, relations, etc. and Propel will do the rest. Then Propel starts generating all the classes automatically, and the .sql files with the database definition schemas. With the classes Propel has generated for us we can access all the basic database access functions, it's what's called CRUD (def.wikipedia).

If you want to dig deeper into the subject I recommend you follow the steps I followed and in 30min you'll feel like one of the family:

  • QuickStart - How to create the DBs, tables and other elements around the data so that we can work with them in a trivial way
  • CRUD explains how to use the basic CRUD functions with Propel.
  • Schemas of the XML files. When we define the schema of the DB we're interested in knowing the supported syntax in depth so as to get the most out of propel's features
  • Relations between tables. Adding a bit of excitement to the data, using simple relations between tables.
  • Error catching. If we're interested in unifying Propel's error output it's very easy to do.
  • Many-to-many relations are not directly supported by propel and have to be done through an intermediate table. Although it lets us get by, it's one of the points to evolve within propel. If we're interested in improving this part we can include our classes implementing that for our code without problems within propel's standard structure. For now, if we want to do it the way the manual suggests.