$record->preSave($event);
$record->getTable()->getRecordListener()->preSave($event);
$state = $record->state();
-
+
if ( ! $event->skipOperation) {
switch ($state) {
case IPF_ORM_Record::STATE_TDIRTY:
if ($record->hasReference($alias)) {
$obj = $record->$alias;
-
// check that the related object is not an instance of IPF_ORM_Null
if ( ! ($obj instanceof IPF_ORM_Null)) {
$obj->save($conn);
$this->saveAssociations($record);
$record->state($state);
-
$conn->commit();
return true;
{
foreach ($record->getReferences() as $k => $v) {
$rel = $record->getTable()->getRelation($k);
-
+ //print get_class($rel);
if ($rel instanceof IPF_ORM_Relation_Association) {
$v->save($this->conn);
$assocTable = $rel->getAssociationTable();
+
foreach ($v->getDeleteDiff() as $r) {
$query = 'DELETE FROM ' . $assocTable->getTableName()
. ' WHERE ' . $rel->getForeign() . ' = ?'
<?php
class IPF_ORM_Exception extends IPF_Exception_Base{
-{
protected static $_errorMessages = array(
IPF_ORM::ERR => 'unknown error',
IPF_ORM::ERR_ALREADY_EXISTS => 'already exists',
}
-
-
-
+
+
+
public function SetFromFormData($cleaned_values)
{
+ $names = $this->_table->getFieldNames();
foreach ($cleaned_values as $key=>$val) {
$validators = $this->getTable()->getFieldValidators($key);
if (
if (($val!==null) && ($val==''))
continue;
}
- $this->$key = $val;
+ if (array_search($key,$names))
+ $this->$key = $val;
}
}
}
\ No newline at end of file