public function replaceIdxSiteContentsUid($siteUid, array $contentUids)
    {
        if (0 < count($contentUids)) {
            $command = 'REPLACE';
            if (!$this->replaceSupported) {
                // REPLACE command not supported, remove first then insert
                $this->removeIdxSiteContentsByUids($siteUid, $contentUids);
                $command = 'INSERT';
            }

            $meta = $this->_em->getClassMetadata('BackBee\ClassContent\Indexes\IdxSiteContent');

            if (!$this->multiValuesSupported) {
                foreach ($contentUids as $contentUid) {
                    $query = $command . ' INTO ' . $meta->getTableName() .
                            ' (' . $meta->getColumnName('site_uid') . ', ' . $meta->getColumnName('content_uid') . ')' .
                            ' VALUES ("' . $siteUid . '", "' . $contentUid . '")';

                    $this->_em->getConnection()->executeUpdate($query);
                }
            } else {
                $query = $command . ' INTO ' . $meta->getTableName() .
                        ' (' . $meta->getColumnName('site_uid') . ', ' . $meta->getColumnName('content_uid') . ')' .
                        ' VALUES ("' . $siteUid . '", "' . implode('"), ("' . $siteUid . '", "', $contentUids) . '")';

                $this->_em->getConnection()->executeUpdate($query);
            }
        }

        return $this;
    }
public function replaceIdxSiteContentsUid($siteUid, array $contentUids)
    {
        if (0 < count($contentUids)) {
            $command = 'REPLACE';
            if (!$this->replaceSupported) {
                // REPLACE command not supported, remove first then insert
                $this->removeIdxSiteContentsByUids($siteUid, $contentUids);
                $command = 'INSERT';
            }

            $meta = $this->_em->getClassMetadata('BackBee\ClassContent\Indexes\IdxSiteContent');

            if (!$this->multiValuesSupported) {
                foreach ($contentUids as $contentUid) {
                    $query = $command . ' INTO ' . $meta->getTableName() .
                            ' (' . $meta->getColumnName('site_uid') . ', ' . $meta->getColumnName('content_uid') . ')' .
                            ' VALUES ("' . $siteUid . '", "' . $contentUid . '")';

                    $this->_em->getConnection()->executeUpdate($query);
                }
            } else {
                $query = $command . ' INTO ' . $meta->getTableName() .
                        ' (' . $meta->getColumnName('site_uid') . ', ' . $meta->getColumnName('content_uid') . ')' .
                        ' VALUES ("' . $siteUid . '", "' . implode('"), ("' . $siteUid . '", "', $contentUids) . '")';

                $this->_em->getConnection()->executeUpdate($query);
            }
        }

        return $this;
    }
public function replaceIdxSiteContentsUid ( $ siteUid , array $ contentUids ) { if ( 0 < count ( $ contentUids ) ) { $ command = 'REPLACE' ; if ( ! $ this -> replaceSupported ) { // REPLACE command not supported, remove first then insert $ this -> removeIdxSiteContentsByUids ( $ siteUid , $ contentUids ) ; $ command = 'INSERT' ; } $ meta = $ this -> _em -> getClassMetadata ( 'BackBee\ClassContent\Indexes\IdxSiteContent' ) ; if ( ! $ this -> multiValuesSupported ) { foreach ( $ contentUids as $ contentUid ) { $ query = $ command . ' INTO ' . $ meta -> getTableName ( ) . ' (' . $ meta -> getColumnName ( 'site_uid' ) . ', ' . $ meta -> getColumnName ( 'content_uid' ) . ')' . ' VALUES ("' . $ siteUid . '", "' . $ contentUid . '")' ; $ this -> _em -> getConnection ( ) -> executeUpdate ( $ query ) ; } } else { $ query = $ command . ' INTO ' . $ meta -> getTableName ( ) . ' (' . $ meta -> getColumnName ( 'site_uid' ) . ', ' . $ meta -> getColumnName ( 'content_uid' ) . ')' . ' VALUES ("' . $ siteUid . '", "' . implode ( '"), ("' . $ siteUid . '", "' , $ contentUids ) . '")' ; $ this -> _em -> getConnection ( ) -> executeUpdate ( $ query ) ; } } return $ this ; }
Replaces or inserts a set of Site-Content indexes.

@param string $siteUid
@param array  $contentUids

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