root/trunk/lib/model/Relevancy.php

Revision 88, 1.0 kB (checked in by fabien, 2 years ago)

updated to symfony 1.0 beta 1

  • Property svn:mime-type set to text/x-php
  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
Line 
1 <?php
2
3 require_once 'lib/model/om/BaseRelevancy.php';
4
5
6 /**
7  * Skeleton subclass for representing a row from the 'ask_relevancy' table.
8  *
9  *
10  *
11  * You should add additional methods to this class to meet the
12  * application requirements.  This class will only be generated as
13  * long as it does not already exist in the output directory.
14  *
15  * @package model
16  */   
17 class Relevancy extends BaseRelevancy
18 {
19   public function save($con = null)
20   {
21     $con = Propel::getConnection();
22     try
23     {
24       $con->begin();
25
26       $ret = parent::save();
27
28       // update relevancy in answer table
29       $answer    = $this->getAnswer();
30       if ($this->getScore() == 1)
31       {
32         $answer->setRelevancyUp($answer->getRelevancyUp() + 1);
33       }
34       else
35       {
36         $answer->setRelevancyDown($answer->getRelevancyDown() + 1);
37       }
38       $answer->save();
39
40       $con->commit();
41
42       return $ret;
43     }
44     catch (Exception $e)
45     {
46       $con->rollback();
47       throw $e;
48     }
49   }
50 }
51
52 ?>
Note: See TracBrowser for help on using the browser.