Added update to TYPO3 refindex for insert and delete
authorChristopher Hlubek <hlubek@networkteam.com>
Sat, 28 Mar 2009 23:17:35 +0000 (23:17 +0000)
committerChristopher Hlubek <hlubek@networkteam.com>
Sat, 28 Mar 2009 23:17:35 +0000 (23:17 +0000)
typo3/sysext/extbase/Classes/Persistence/Mapper/ObjectRelationalMapper.php

index c5756cc..e53b7e2 100644 (file)
@@ -56,6 +56,13 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
        protected $database;
        
        /**
+        * The TYPO3 reference index object
+        *
+        * @var t3lib_refindex
+        **/
+       protected $refIndex;
+       
+       /**
         * Statistics with counts of database operations
         *
         * @var array
@@ -77,6 +84,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
                $this->persistenceSession = t3lib_div::makeInstance('Tx_ExtBase_Persistence_Session');
                $GLOBALS['TSFE']->includeTCA();
                $this->database = $GLOBALS['TYPO3_DB'];
+               $this->refIndex = t3lib_div::makeInstance('t3lib_refindex');
        }
 
        /**
@@ -460,7 +468,10 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
                        $row
                        );
                $this->statistics['insert']++;
-               $object->_reconstituteProperty('uid', $this->database->sql_insert_id());
+               $uid = $this->database->sql_insert_id();
+               $object->_reconstituteProperty('uid', $uid);
+               
+               $this->refIndex->updateRefIndexTable($tableName, $uid);
 
                $this->persistRelations($object, $propertyName, $this->getRelations($dataMap, $properties));
        }
@@ -535,6 +546,7 @@ class Tx_ExtBase_Persistence_Mapper_ObjectRelationalMapper implements t3lib_Sing
                                );
                        $this->statistics['delete']++;
                }
+               $this->refIndex->updateRefIndexTable($tableName, $uid);
 
                if ($recurseIntoRelations === TRUE) {
                        $this->processRelations($object, $propertyName, $relations);