private function replaceIdxContentContentsByUids(array $parentUids)
    {
        if (0 < count($parentUids)) {
            $command = 'REPLACE';
            if (!$this->replaceSupported) {
                // REPLACE command not supported, remove first then insert
                $this->_removeIdxContentContents(array_keys($parentUids));
                $command = 'INSERT';
            }

            $meta = $this->_em->getClassMetadata('BackBee\ClassContent\Indexes\IdxContentContent');
            $insertChildren = array();
            foreach ($parentUids as $parentUid => $subContentUids) {
                foreach ($subContentUids as $subContentUid) {
                    $insertChildren[] = sprintf('SELECT "%s", "%s"', $parentUid, $subContentUid);
                    $insertChildren[] = sprintf('SELECT %s, "%s"
                        FROM %s
                        WHERE %s = "%s"', $meta->getColumnName('content_uid'), $subContentUid, $meta->getTableName(), $meta->getColumnName('subcontent_uid'), $parentUid
                    );
                }
            }

            if (0 < count($insertChildren)) {
                $unionAll = implode(' UNION ALL ', $insertChildren);
                $query = sprintf('%s INTO %s (%s, %s) %s',
                    $command,
                    $meta->getTableName(),
                    $meta->getColumnName('content_uid'),
                    $meta->getColumnName('subcontent_uid'),
                    $unionAll
                );
                $this->_em->getConnection()->executeUpdate($query);
            }
        }

        return $this;
    }
private function replaceIdxContentContentsByUids(array $parentUids)
    {
        if (0 < count($parentUids)) {
            $command = 'REPLACE';
            if (!$this->replaceSupported) {
                // REPLACE command not supported, remove first then insert
                $this->_removeIdxContentContents(array_keys($parentUids));
                $command = 'INSERT';
            }

            $meta = $this->_em->getClassMetadata('BackBee\ClassContent\Indexes\IdxContentContent');
            $insertChildren = array();
            foreach ($parentUids as $parentUid => $subContentUids) {
                foreach ($subContentUids as $subContentUid) {
                    $insertChildren[] = sprintf('SELECT "%s", "%s"', $parentUid, $subContentUid);
                    $insertChildren[] = sprintf('SELECT %s, "%s"
                        FROM %s
                        WHERE %s = "%s"', $meta->getColumnName('content_uid'), $subContentUid, $meta->getTableName(), $meta->getColumnName('subcontent_uid'), $parentUid
                    );
                }
            }

            if (0 < count($insertChildren)) {
                $unionAll = implode(' UNION ALL ', $insertChildren);
                $query = sprintf('%s INTO %s (%s, %s) %s',
                    $command,
                    $meta->getTableName(),
                    $meta->getColumnName('content_uid'),
                    $meta->getColumnName('subcontent_uid'),
                    $unionAll
                );
                $this->_em->getConnection()->executeUpdate($query);
            }
        }

        return $this;
    }
private function replaceIdxContentContentsByUids ( array $ parentUids ) { if ( 0 < count ( $ parentUids ) ) { $ command = 'REPLACE' ; if ( ! $ this -> replaceSupported ) { // REPLACE command not supported, remove first then insert $ this -> _removeIdxContentContents ( array_keys ( $ parentUids ) ) ; $ command = 'INSERT' ; } $ meta = $ this -> _em -> getClassMetadata ( 'BackBee\ClassContent\Indexes\IdxContentContent' ) ; $ insertChildren = array ( ) ; foreach ( $ parentUids as $ parentUid => $ subContentUids ) { foreach ( $ subContentUids as $ subContentUid ) { $ insertChildren [ ] = sprintf ( 'SELECT "%s", "%s"' , $ parentUid , $ subContentUid ) ; $ insertChildren [ ] = sprintf ( 'SELECT %s, "%s"
                        FROM %s
                        WHERE %s = "%s"' , $ meta -> getColumnName ( 'content_uid' ) , $ subContentUid , $ meta -> getTableName ( ) , $ meta -> getColumnName ( 'subcontent_uid' ) , $ parentUid ) ; } } if ( 0 < count ( $ insertChildren ) ) { $ unionAll = implode ( ' UNION ALL ' , $ insertChildren ) ; $ query = sprintf ( '%s INTO %s (%s, %s) %s' , $ command , $ meta -> getTableName ( ) , $ meta -> getColumnName ( 'content_uid' ) , $ meta -> getColumnName ( 'subcontent_uid' ) , $ unionAll ) ; $ this -> _em -> getConnection ( ) -> executeUpdate ( $ query ) ; } } return $ this ; }
Replaces a set of Site-Content indexes.

@param array  $parentUids

@return \BackBee\ClassContent\Repository\IndexationRepository
Replaces a set of Site - Content indexes .