Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1.   public function save(Doctrine_Connection $conn = null)
  2.   {
  3.    
  4.     $conn = $conn ? $conn : TrackTable::getConnection();
  5.     $conn->beginTransaction();
  6.     try
  7.     {
  8.         $ret = parent::save($conn);
  9.  
  10.         $conn->commit();
  11.         $this->updateLuceneIndex();
  12.       return $ret;
  13.     }
  14.     catch (Exception $e)
  15.     {
  16.         $conn->rollBack();
  17.       throw $e;
  18.     }  
  19.   }
  20.  
  21.  
  22.     public static function reIndex()
  23.     {
  24.         $tracks = Doctrine::getTable('track')
  25.         ->createQuery('t')
  26.         ->execute();
  27.        
  28.         foreach($tracks as $track)
  29.         {
  30.             echo $track->getId() . "\n";
  31.             $track->state('DIRTY');
  32.             $track->save();
  33.         }
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement