Hi,
I'm using a ManyManyDataObjectManager asociated to a DataObject, and I'm checking some fields within an OnBeforeWrite method.
The checking process works fine, but the error messages look pretty awful (it displays source code and trace data). This is the code I'm using in the OnBeforeWrite() method:
...
function onBeforeWrite() {
parent::onBeforeWrite();
// check for unique artist name (LastName + FirstName)
$where = "FirstName = '$this->FirstName' AND LastName = '$this->LastName'";
if ($this->ID) { // not first write action
$where .= " AND ID != '$this->ID'";
}
$artists = DataObject::get("Artist", $where);
if($artists) {
user_error('The artist already exists', E_USER_ERROR);
exit();
}
}
...
Is there any special way for displaying/beautifying error messages related to a DataObjectManager?
Thanks in advance.