if ($object->_isNew()) {
$this->insertObject($object, $parentObject, $parentPropertyName, $row);
} elseif ($object->_isDirty()) {
- $this->updateObject($object, $parentObject, $parentPropertyName, $row);
+ $this->updateObject($object, $parentObject, $parentPropertyName, $row);
}
// SK: I need to check the code below more thoroughly
$tableName = $dataMap->getColumnMap($parentPropertyName)->getRelationTableName();
$res = $this->storageBackend->addRow(
$tableName,
- $row
- );
+ $row,
+ TRUE);
return $res;
}
foreach ($relatedObjects as $relatedObject) {
$this->deleteObject($relatedObject, $object, $propertyName);
if ($dataMap->getColumnMap($propertyName)->getTypeOfRelation() === Tx_Extbase_Persistence_Mapper_ColumnMap::RELATION_HAS_AND_BELONGS_TO_MANY) {
+ // SK: This method does IMHO not exist.
$this->deleteRelationInRelationTable($relatedObject, $object, $propertyName);
}
}
*
* @param string $tableName The database table name
* @param array $row The row to insert
+ * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
* @return void
*/
- public function addRow($tableName, array $row);
+ public function addRow($tableName, array $row, $isRelation = FALSE);
/**
* Updates a row in the storage
*
* @param string $tableName The database table name
* @param array $row The row to update
+ * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
* @return void
*/
- public function updateRow($tableName, array $row);
+ public function updateRow($tableName, array $row, $isRelation = FALSE);
/**
* Deletes a row in the storage
*
* @param string $tableName The database table name
* @param int $uid The uid of the row to delete
+ * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
* @return void
*/
- public function removeRow($tableName, $uid);
+ public function removeRow($tableName, $uid, $isRelation = FALSE);
/**
* Returns an array with rows matching the query.
*
* @param string $tableName The database table name
* @param array $row The row to be inserted
+ * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
* @return int The uid of the inserted row
*/
- public function addRow($tableName, array $row) {
+ public function addRow($tableName, array $row, $isRelation = FALSE) {
$fields = array();
$values = array();
$parameters = array();
$this->databaseHandle->sql_query($sqlString);
$uid = $this->databaseHandle->sql_insert_id();
- $this->clearPageCache($tableName, $uid);
+ if (!$isRelation) {
+ $this->clearPageCache($tableName, $uid);
+ }
return $uid;
}
*
* @param string $tableName The database table name
* @param array $row The row to be updated
+ * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
* @return void
*/
- public function updateRow($tableName, array $row) {
+ public function updateRow($tableName, array $row, $isRelation = FALSE) {
if (!isset($row['uid'])) throw new InvalidArgumentException('The given row must contain a value for "uid".');
$uid = (int)$row['uid'];
unset($row['uid']);
$this->replacePlaceholders($sqlString, $parameters);
$returnValue = $this->databaseHandle->sql_query($sqlString);
- $this->clearPageCache($tableName, $uid);
+ if (!$isRelation) {
+ $this->clearPageCache($tableName, $uid);
+ }
return $returnValue;
}
*
* @param string $tableName The database table name
* @param array $uid The uid of the row to be deleted
+ * @param boolean $isRelation TRUE if we are currently inserting into a relation table, FALSE by default
* @return void
*/
- public function removeRow($tableName, $uid) {
+ public function removeRow($tableName, $uid, $isRelation = FALSE) {
$sqlString = 'DELETE FROM ' . $tableName . ' WHERE uid=?';
$this->replacePlaceholders($sqlString, array((int)$uid));
- $this->clearPageCache($tableName, $uid);
+ if (!$isRelation) {
+ $this->clearPageCache($tableName, $uid, $isRelation);
+ }
$returnValue = $this->databaseHandle->sql_query($sqlString);
return $returnValue;
}