Example #1
0
 /**
  * @see ValueTypeInterface::delete()
  * @return bool
  */
 public function delete()
 {
     global $transaction;
     if ($this->value_type and $this->value_type_id) {
         $value_array = Value::list_entries_by_type_id($this->value_type_id);
         if (is_array($value_array)) {
             if (count($value_array) != 0) {
                 return false;
             }
         }
         $transaction_id = $transaction->begin();
         $olvdl = new Olvdl($this->value_type->get_template_id());
         if ($this->value_type->delete() == false) {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             return false;
         }
         if ($olvdl->delete() == false) {
             if ($transaction_id != null) {
                 $transaction->rollback($transaction_id);
             }
             return false;
         } else {
             if ($transaction_id != null) {
                 $transaction->commit($transaction_id);
             }
             return true;
         }
     } else {
         return false;
     }
 }