public static function getPriorityObject($object)
 {
     $c = new Criteria();
     $c->add(sfPriorityPeer::PRIORITISABLE_ID, $object->getPrioritisableReferenceKey());
     $c->add(sfPriorityPeer::PRIORITISABLE_MODEL, get_class($object));
     return sfPriorityPeer::doSelectOne($c);
 }
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(sfPriorityPeer::ID, $pks, Criteria::IN);
         $objs = sfPriorityPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 /**
  * Retrieve an existing priority object, or return a new empty one
  *
  * @param  BaseObject  $object
  * @param  mixed       $user_id  Unique user primary key
  * @return sfPriority
  * @throws deppPropelActAsPrioritisableException
  **/
 protected static function getOrCreate(BaseObject $object, $user_id = null)
 {
     if ($object->isNew()) {
         throw new deppPropelActAsPrioritisableException('Unsaved objects are not prioritisable');
     }
     if (is_null($user_id)) {
         return new sfPriority();
     }
     $c = new Criteria();
     $c->add(sfPriorityPeer::PRIORITISABLE_ID, $object->getPrioritisableReferenceKey());
     $c->add(sfPriorityPeer::PRIORITISABLE_MODEL, get_class($object));
     $priority = sfPriorityPeer::doSelectOne($c);
     return is_null($priority) ? new sfPriority() : $priority;
 }
} catch (PropelException $e) {
    $t->fail($e->getMessage());
    return 0;
}
$method_getter = TEST_METHOD_GETTER;
$method_setter = TEST_METHOD_SETTER;
// remove the prioritisable objects (and thus their priorities)
// and tests the preDelete method
$c = new Criteria();
$prioritisable_objects = call_user_func(array(_create_object()->getPeer(), 'doSelect'), $c);
foreach ($prioritisable_objects as $po) {
    $po->delete();
}
$c = new Criteria();
$c->add(sfPriorityPeer::PRIORITISABLE_MODEL, 'sfTestPrioritisable');
$priorities = sfPriorityPeer::doSelect($c);
$t->ok(count($priorities) == 0, 'all priorities related to sfTestPrioritisable objects have been removed');
// an object is created and a test on the countPriorities and getPriority values is performed
$obj1 = _create_object();
$t->ok($obj1->hasBeenPrioritised() == false, 'a new object has never been prioritised.');
$t->ok($obj1->getPriorityValue() == 0, 'a new object has a priority of 0');
$obj1->save();
$obj2 = _create_object();
$obj2->save();
// Override any existing max_priority parameter
sfConfig::set(sprintf('propel_behavior_deppPropelActAsPrioritisableBehavior_%s_max_priority', get_class($obj1)), 2);
$t->is($obj1->getMaxPriority(), 2, 'getMaxRange() read the max_priority parameter (changed at runtime)');
// control if the null priority is accepted
sfConfig::set(sprintf('propel_behavior_deppPropelActAsPrioritisableBehavior_%s_null_priority', get_class($obj1)), true);
$t->is($obj1->allowsNullPriority(), true, 'allowsNullPriority() returns if the null priority is allowed or not');
// define three users