propel

Database Error Handling: What if You have to Call Outside service and the Transaction Fails?

We all know that we can always wrap our database call in transaction ( with or without a proper ORM), in a form like this: $con = Propel::getConnection(EventPeer::DATABASE_NAME); try { $con->begin(); // do your update, save, delete or whatever here. $con->commit(); } catch (PropelException $e) { $con->rollback(); thr...

reverse engineering in symfony

I have a database. I am trying to reverse engineer using symfony to create schema.yml. I get this error message: [propel-schema-reverse] There was an error building XML from metadata: SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet I can generate the schema.xml using Creole but ...

Is there any way to output the sql generated by a propel select in symfony?

I want to output the query generated by a symfony propel select for testing purposes. Is there any way to do this? I know I can use the sf_debug bar, but sometimes I need to see the statement in a situation where the sf_debug bar hasn't loaded yet, or isn't going to load at all. ...

Propel NestedSet creating Balanced Tree

Hi folks, I'm trying to use Propel's NestedSet feature. However, I'm missing something about inserting such that the tree is balanced as it is created (i.e. fill it in horizontally). Say I have these elements: root r1c1 r1c2 r2c1 r2c2 I want to insert r2c3 as the 1st child of r1c2 (i.e. fill row 2 before starting on r...

Loader.php trying to load Doctrine classes, but we use Propel!

We are finding cases where we get the following 500 error: File xyz.php does not exist or class "xyz" was not found in the file at () in SF_ROOT_DIR/lib/vendor/Zend/Loader.php line 107 ... where xyz == Memcache (when trying to use symfony cc on the command line) or sfDoctrineAdminGenerator (when using an old-ish AdminGenerator-g...

Is there a way to set the default values for sfWidgetFormFilterDate widget?

I have an auto generated BaseBlahBlahBlahFilter.class file in my /lib/filter/base/ folder. It contain the following line for 'data' type field : 'date' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)), When the form loads it shows me empty va...

issue about selecting objects in an inheritance context in propel-symfony

Hi, I have an issue that is quite annoying with symfony 1.2 and propel. I have a model where I have implemented inheritance using the single-table strategy. So, here is an excerpt of my model: Ad (id, posted_date, description) then RealEstateAd(location, price, transaction_type) and JobAd(position, requirements, company) which inherit bo...

How do I setup Symfony to create multiple database schemas?

In my project I have 2 databases. propel-build-model is already set up to work for 2 databases - http://stackoverflow.com/questions/733224/multiple-databases-support-in-symfony If I make changes to either of the databases, I need the propel-build-schema command to rebuild the schemas for both. I know I can do this manually by amending ...

Switch symfony 1.4 from doctrene to propel

How can I properly switch the newly installed Symfony 1.4 framework from Doctrine (that it is configured for by default) to Propel? ...

incremental update with symfony/propel

Hi, I would like execute a query like this one in symfony using the Propel ORM: UPDATE ADS SET HITS=HITS+1 WHERE ID=10; I know that Propel API can let me set a previously fixed value for a column of a given record, but I definitely don't want to retrieve the column value first before issuing an update query since there are concurrent...

Propel ORM including MAX in criteria

I am writing a query using the Propel ORM The query is of the form: select * from some_table where some_table.created_at = (SELECT MAX(some_table.created_at) from some_table); I got this far: $c = new Criteria(); $c->addSelectColumn('MAX('.self::CREATED_AT.')'); Anyone knows how to use Propel to do this, to save me writing RAW S...

Injecting Criteria into an sfPropelRoute object

I have a Page object whose uniqueness comes from its PageDomain. The schema is configured such that the page table contains a page_domain_id field to create the relationship. To show a page, I have an executeShow action and a custom handler. My route looks like this: page_show: url: /:domain_slug/:slug class: sfPropelRoute o...

UNION query with Propel ORM

I'm trying to create a UNION query using the Propel ORM e.g $criterion1 UNION $criterion2 anyone knows how to do this? ...

PHP ORMs: Doctrine vs. Propel

Hi, I'm starting a new project with symfony which is readily integrated with Doctrine and Propel, but I of course need to make a choice.... I was wondering if more experienced people out there have general pros and/or cons for going with either of these two? Thanks a lot. EDIT: Thanks for the all the responses, useful stuff. There's n...

Propel Single Table Inheritance Issue

I have a table called "talk", which is defined as abstract in my schema.xml file. It generates 4 objects (1 per classkey): Comment, Rating, Review, Checkin It also generates TalkPeer, but I couldn't get it to generate the other 4 peers (CommentPeer, RatingPeer, ReviewPeer, CheckinPeer), so I created them by hand, and made them inherit ...

Doctrine to Propel snippet

I am using the Propel ORM with SF (1.4). I am writing a class, and I need to rewrite a query Doctrine query into Propel: $q = Doctrine_Core::getTable('sfGuardRememberKey')->createQuery('r') ->innerJoin('r.sfGuardUser u') ->where('r.remember_key = ?', $cookie); if ($q->count()){ // Do Something } can anyone help wi...

symfony setPostValidator with sfValidatorFile

I am going through an issue to setup a file upload validator on callback. I want to achieve this: I have a form, where user choose the type of the file they are uploading and upload the file. So I want to set the validator to handle images in case they chose "img" as type, and pdf if they chose "pdf". Moreover I want to specify the mi...

Error using propel, it can't find build-propel.xml

When trying to create a build using propel-gen (propel v 1.4) I get: [phing] Error reading project file [wrapped: Unable to open /path/to/project/build-propel.xml for reading: ] I can't find a reference to this file in the propel documentation. ...

Saving and retrieving blobs using Propel ORM (YML, Propel and PHP question)

I am using Propel (1.4) with Symfony 1.31 (with mySQL db). I want to save save/retriev BLOB (gzipped) data to/from the database My db schema is defined in YML. Suppose the schema looks like this: demo_blobbed_object: _attributes: { phpName: MrBlobby } id: name: {type: varchar(32)} data: {type: ? } I have the following questi...

symfony proper initialization of database connection

I use the following code to make Propel 1.4 works in a php file. what should i do to make sure DatabaseManager delete correctly after its work? shutdown at the end of the php file?? what will happen if there are multiple accesses to the same php file at the same time? <?php require_once(dirname(__FILE__).'/../config/ProjectConfigura...