Development

#3306 ([sfPropelFinder] Added function set() (Fluid interface to BasePeer::doUpdate()))

You must first sign up to be able to contribute.

Ticket #3306 (new enhancement)

Opened 1 month ago

[sfPropelFinder] Added function set() (Fluid interface to BasePeer::doUpdate())

Reported by: jug Assigned to: francois
Priority: minor Milestone:
Component: sfPropelFinderPlugin Version: 1.0.12
Keywords: Cc:
Qualification: Unreviewed

Description

set()

set() is a fluid Interface to BasePeer::doUpdate()

sfPropelFinder::from('Article')
   ->whereVersion(1)
   ->andTitle('foo')
   ->orTitle('bar')
   ->set( array( 'Title'=>'updated title', 'Version'=>2 ) );

The API is quiet simple :

  1. Use fluid Interface to find objects to update
  2. Call set() with an associative array where the keys are the field

names to change and the values the new values to set. I used the syntax set() as function name cause it remeber me the SQL syntax : UPDATE table SET x=a, y=b, z=c WHERE ...

One big limitation to set() : Propel doesn't sound to support multitable table update syntax !!''' So

sfPropelFinder::from('Foo')->joinBar()->set($associative_array);

Will thow the following Exception :

throw new Exception('{sfPropelFinder::set()} Propel does not support multitable updates, please do not use join');

Attched to this ticket : diff files for sfPropelFinder.php and sfPropelFinderTest.php (3 new tests)

Regards,

Julien

Attachments

sfPropelFinder.php.diff (1.4 kB) - added by jug on 04/10/08 15:10:19.
sfPropelFinderTest.php.diff (1.6 kB) - added by jug on 04/10/08 15:10:36.

Change History

04/10/08 15:10:19 changed by jug

  • attachment sfPropelFinder.php.diff added.

04/10/08 15:10:36 changed by jug

  • attachment sfPropelFinderTest.php.diff added.