63 return $this->properties->isValid();
76 public function __call($a_method, $a_value)
78 $type = substr($a_method, 0, 3);
81 $parsed = strtolower(preg_replace(
"/([A-Z])/",
" $1", substr($a_method, 3)));
82 $parsed = str_replace(
" ",
"_", trim($parsed));
83 if (!$this->properties->hasElement($parsed)) {
84 throw new Exception(
"ilADTObject unknown property " . $parsed);
86 return $this->properties->getElement($parsed);
89 throw new Exception(
"ilADTObject unknown method " . $parsed);
104 abstract protected function parsePrimary(array $a_args);
136 $ilDB = $DIC[
'ilDB'];
139 throw new Exception(
"ilADTBasedObject no primary");
143 $this->adt_db =
$factory->getDBBridgeForInstance($this->properties);
147 include_once
"Services/ADT/classes/class.ilADTDBException.php";
148 $ilDB->exception =
"ilADTDBException";
150 return $factory->getActiveRecordInstance($this->adt_db);
184 $this->db_errors[$e->
getColumn()][] = $e->getCode();
209 $this->db_errors[$e->
getColumn()][] = $e->getCode();
222 public function delete()
256 foreach ($a_codes as
$code) {
258 case MDB2_ERROR_CONSTRAINT:
259 $res[] =
$lng->txt(
"adt_error_db_constraint");
263 $res[] =
"Unknown ADT error code " .
$code;
281 foreach ($this->
getProperties()->getValidationErrorsByElements() as $error_code => $element_id) {
282 $tmp[] = $element_id .
" [validation]: " . $this->
getProperties()->translateErrorCode($error_code);
285 foreach ($this->
getDBErrors() as $element_id => $codes) {
initActiveRecordInstance()
Init active record helper for current table, primary and properties.
hasPrimary()
Check if currently has primary.
createPrimaryKey()
Create new primary key, e.g.
translateDBErrorCodes(array $a_codes)
Translate DB error codes.
initProperties()
Init properties (aka set ADT definition)
static getInstance()
Get singleton.
__construct()
Constructor.
parsePrimary(array $a_args)
Parse incoming primary key.
getDBErrors()
Get DB errors.
initDBBridge(ilADTGroupDBBridge $a_adt_db)
Init (properties) DB bridge.
foreach($_POST as $key=> $value) $res
update()
Update record (only if valid)
__call($a_method, $a_value)
Get property magic method ("get<PropertyName>()")
getProperties()
Get all properties.
getAllTranslatedErrors($delimiter="\)
Get translated error codes (DB, Validation)
ADT based-object base class.
create()
Create record (only if valid)