// get ids for toUpdate
$idxIdMap = $this->_filterEventsByDTStarts($_currentPersistentExceptions, $toUpdateDtSTart)->getId();
- try {
- $migration['toUpdate']->setByIndices('id', $idxIdMap);
- } catch (Tinebase_Exception_Record_NotDefined $ternd) {
- // some debugging for 0008182: event with lots of exceptions breaks calendar sync
- if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($idxIdMap, TRUE));
- if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($migration['toUpdate']->toArray(), TRUE));
- throw $ternd;
- }
+ $migration['toUpdate']->setByIndices('id', $idxIdMap, /* $skipMissing = */ true);
// filter exceptions marked as don't touch
foreach ($migration['toUpdate'] as $toUpdate) {
*
* @param string $_name property name
* @param array $_values index => property value
+ * @param boolean $skipMissing
* @throws Tinebase_Exception_Record_NotDefined
*/
- public function setByIndices($_name, array $_values)
+ public function setByIndices($_name, array $_values, $skipMissing = false)
{
foreach ($_values as $index => $value) {
if (! (isset($this->_listOfRecords[$index]) || array_key_exists($index, $this->_listOfRecords))) {
- throw new Tinebase_Exception_Record_NotDefined('Could not find record with index ' . $index);
+ if ($skipMissing) {
+ if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__
+ . ' Skip missing record ' . $index . ' => ' . $value . ' property: ' . $_name);
+ continue;
+ } else {
+ throw new Tinebase_Exception_Record_NotDefined('Could not find record with index ' . $index);
+ }
}
$this->_listOfRecords[$index]->$_name = $value;
}