Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
typo3
typo3
Commits
525c977f
Commit
525c977f
authored
Jul 14, 2009
by
Sebastian Kurfürst
Browse files
Extbase:
* Fixed issue that cache is tried to be cleared even if a relation is changed
parent
dd17a789
Changes
3
Hide whitespace changes
Inline
Side-by-side
typo3/sysext/extbase/Classes/Persistence/Backend.php
View file @
525c977f
...
...
@@ -313,7 +313,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
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
...
...
@@ -396,8 +396,8 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
$tableName
=
$dataMap
->
getColumnMap
(
$parentPropertyName
)
->
getRelationTableName
();
$res
=
$this
->
storageBackend
->
addRow
(
$tableName
,
$row
);
$row
,
TRUE
);
return
$res
;
}
...
...
@@ -551,6 +551,7 @@ class Tx_Extbase_Persistence_Backend implements Tx_Extbase_Persistence_BackendIn
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
);
}
}
...
...
typo3/sysext/extbase/Classes/Persistence/Storage/BackendInterface.php
View file @
525c977f
...
...
@@ -39,27 +39,30 @@ interface Tx_Extbase_Persistence_Storage_BackendInterface {
*
* @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.
...
...
typo3/sysext/extbase/Classes/Persistence/Storage/Typo3DbBackend.php
View file @
525c977f
...
...
@@ -91,9 +91,10 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
*
* @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
();
...
...
@@ -109,7 +110,9 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
$this
->
databaseHandle
->
sql_query
(
$sqlString
);
$uid
=
$this
->
databaseHandle
->
sql_insert_id
();
$this
->
clearPageCache
(
$tableName
,
$uid
);
if
(
!
$isRelation
)
{
$this
->
clearPageCache
(
$tableName
,
$uid
);
}
return
$uid
;
}
...
...
@@ -118,9 +121,10 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
*
* @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'
]);
...
...
@@ -136,7 +140,9 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
$this
->
replacePlaceholders
(
$sqlString
,
$parameters
);
$returnValue
=
$this
->
databaseHandle
->
sql_query
(
$sqlString
);
$this
->
clearPageCache
(
$tableName
,
$uid
);
if
(
!
$isRelation
)
{
$this
->
clearPageCache
(
$tableName
,
$uid
);
}
return
$returnValue
;
}
...
...
@@ -145,12 +151,15 @@ class Tx_Extbase_Persistence_Storage_Typo3DbBackend implements Tx_Extbase_Persis
*
* @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
;
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment