protected $_filters = array(
'date_stringtrim' => 'StringTrim',
'stringtrim' => 'StringTrim'
-
);
/**
'date_multiple' => array(),
'leadstate' => array('allowEmpty' => false, 'Alpha' ),
'inarray' => array(array('InArray', array('value1', 'value2')), 'allowEmpty' => true),
+ 'set1' => array('allowEmpty' => true),
+ 'set2' => array('allowEmpty' => true),
);
/**
'string' => 'test',
'test_1' => 25,
'test_2' => 99,
- 'date_single' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG)
+ 'date_single' => Tinebase_DateTime::now()->get(Tinebase_Record_Abstract::ISO8601LONG),
+ 'set1' => new Tinebase_Record_RecordSet('Tinebase_Record_DummyRecord'),
), true);
$record2 = clone $record1;
$record2->string = 'anders';
$record2->test_1 = 26;
+ $record2->set2 = new Tinebase_Record_RecordSet('Tinebase_Record_DummyRecord');
$diff = $record1->diff($record2)->diff;
$this->assertEquals(2, count($diff), 'expected difference in string & test_1: ' . print_r($diff, TRUE));
$this->assertEquals('anders', $diff['string']);
$toConvert = $this->_properties[$field];
}
- foreach ($toConvert as $field => &$value) {
+ foreach ($toConvert as $convertField => &$value) {
if (! method_exists($value, 'setTimezone')) {
- throw new Tinebase_Exception_Record_Validation($field . 'must be a method setTimezone');
+ throw new Tinebase_Exception_Record_Validation($convertField . ' must be a method setTimezone');
}
$value->setTimezone($_timezone);
}
}
if ($_recursive) {
- foreach ($this->_properties as $property => $value) {
- if ($value && is_object($value) &&
- (in_array('Tinebase_Record_Interface', class_implements($value)) ||
- $value instanceof Tinebase_Record_Recordset) ) {
-
- $value->setTimezone($_timezone, TRUE);
+ foreach ($this->_properties as $property => $propValue) {
+ if ($propValue && is_object($propValue) &&
+ (in_array('Tinebase_Record_Interface', class_implements($propValue)) ||
+ $propValue instanceof Tinebase_Record_Recordset) ) {
+
+ $propValue->setTimezone($_timezone, TRUE);
}
}
}
*/
public function __toString()
{
- return print_r($this->toArray(), TRUE);
+ return (string) print_r($this->toArray(), true);
}
/**
continue;
} else if (empty($ownField) && empty($recordField)) {
continue;
+ } else if ((empty($ownField) && $recordField instanceof Tinebase_Record_RecordSet && count($recordField) == 0)
+ || (empty($recordField) && $ownField instanceof Tinebase_Record_RecordSet && count($ownField) == 0) )
+ {
+ continue;
}
+
+ if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ .
+ ' Found diff for ' . $fieldName .'(this/other):' . print_r($ownField, true) . '/' . print_r($recordField, true) );
$diff[$fieldName] = $recordField;
}