Пример #1
0
 /**
  * Undelete a table entry from the recycle bin and store it back to the table.
  * @param string $tablename The table to retrieve data from
  * @param string $id The id of the table entry to undelete. If the id field was altered in the recycle bin table, then the new id will be used, not the old id when the object was stored.
  * @param string $idfieldname The primary key id of the table; could be null and retrieved automatically
  * @return boolean true, if successful
  */
 public static function undeleteObject($tablename, $id, $idfieldname = null) {
     if (is_null($idfieldname))
         $idfieldname = DBHelper::primaryKeyOf($tablename);
     if (is_null($idfieldname))
         return null;
     $result = Recycle::restoreObject($tablename, $id, $idfieldname);
     if ($result)
         return Recycle::restoreFromRecycle($tablename, $result, $id);
     else
         return false;
 }