Tag Archives: propel

Tip: Working with BLOB column

This article has moved to this location.


Let’s say we have the following XML Schema:

<table name="product_image">
  <column name="id" type="integer" required="true" primaryKey="true" autoIncrement="true" />
  <column name="name" type="varchar" required="true" size="255" />
  <column name="filename" type="blob" required="true" />
  <column name="description" type="longvarchar" required="true" />
  <column name="extension" type="varchar" size="5" required="true" />
</table>

How to read and write blob type using Propel?
Read More

sfAdminAjaxThemePlugin now in symfony plugin repository

This article has moved to this location.


In my previous article, i’ve shown you how to ajaxify symfony admin generator, and now it has been packaged as a plugin and is available to download. This plugin still in an alpha state, and it use propel (sfPropelPlugin or sfPropel15Plugin) as an ORM. So i welcome your feedback.

Update

Here are some screenshots:


Screenshot when an item was deleted successfully

Screenshot when an item was deleted successfully


Read More

sfPropelCustomSelectPlugin sample usage

This article has moved to this location.


A few days ago, i’ve made sfPropelCustomSelectPlugin, a plugin that allow to select arbitrary columns without loosing the power of Propel ORM. In this article, i would like to show you how to use the plugin in your application. This plugin was designed to work well with doSelect, doSelectJoinXXX functions and sfPropelPager class. If you are using propel 1.5 you can using ModelCriteria::select() and ModelCriteria::withColumn() together to achieve the same result (http://www.propelorm.org/ticket/1172).
I assume that you have already installed the plugin correctly.
Read More

Selecting arbitrary┬ácolumns using propel

Generally we cannot use hydrate() with a query where we specify our own select columns. Propel always assumes that statements passed to hydrate() contain the full properties for the object. But of course we can still get the object(s) by populating the statements manually.

while ($row = $stmt->fetch (PDO::FETCH_NUM))
{
   $myClass = new myClass();
   $myClass->setId($row[0]);
   ....
   $myClasses[] = $myClass;
}
return $myClasses;

But the problem will arise when we are working with sfPropelPager, because sfPropelPager only works with Object.
So, how to return the propel object(s) when we want to select only a few columns?. In this article, i would like to share my idea how to solve the problem stated above.
Read More

‘Pick or create’ embedded form the propel way

In my recent application, i want a user able to select the input from the existing options, or create new if the option is not available. After googling on the internet, I found an interesting article how to overcome these problem.
Inspired by Propel 1.5 features ( embedRelation and mergeRelation), I rewrite the method in that article, so we just simply write ’embedPickOrCreateForm ()’ to implement the problem.
Read More