/** * @see ValueTypeInterface::create() * @param integer $object_id * @return integer */ public function create($data_entity_id) { global $transaction; if ($this->value_type and is_numeric($data_entity_id)) { $xml_cache = new XmlCache($data_entity_id); $xml_array = $xml_cache->get_xml_array(); $olvdl_found = false; $title_found = false; $id_found = false; $id = null; $title = ""; if (is_array($xml_array) and count($xml_array) >= 1) { foreach ($xml_array as $key => $value) { $value[1] = trim(strtolower($value[1])); $value[2] = trim($value[2]); if ($value[1] == "olvdl" and $value[2] != "#") { $olvdl_found = true; } if ($value[1] == "title" and $value[2] != "#") { if ($value[2]) { $title = trim($value[2]); $title_found = true; } } if ($value[1] == "id" and $value[2] != "#") { if ($value[2]) { if (is_numeric(trim($value[2]))) { $id = (int) trim($value[2]); $id_found = true; } } } } if ($olvdl_found == false or $title_found == false or $id_found == false) { return false; } $transaction_id = $transaction->begin(); $olvdl = new Olvdl(null); if (($olvdl_id = $olvdl->create($data_entity_id)) == null) { if ($transaction_id != null) { $transaction->rollback($transaction_id); } return false; } if ($this->value_type->create($id, $title, $olvdl_id) == 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; } } else { return false; } }