Commit 39bfb030 authored by zYne's avatar zYne

--no commit message

--no commit message
parent 0f79ed1d
...@@ -32,11 +32,16 @@ ...@@ -32,11 +32,16 @@
*/ */
class Doctrine_Search extends Doctrine_Plugin class Doctrine_Search extends Doctrine_Plugin
{ {
const INDEX_FILES = 0;
const INDEX_TABLE = 1;
protected $_options = array('generateFiles' => false, protected $_options = array('generateFiles' => false,
'className' => '%CLASS%Index', 'className' => '%CLASS%Index',
'generatePath' => false, 'generatePath' => false,
'batchUpdates' => false, 'batchUpdates' => false,
'pluginTable' => false); 'pluginTable' => false,
'fields' => array());
public function __construct(array $options) public function __construct(array $options)
...@@ -97,6 +102,12 @@ class Doctrine_Search extends Doctrine_Plugin ...@@ -97,6 +102,12 @@ class Doctrine_Search extends Doctrine_Plugin
} }
} }
public function readTableData($limit = null, $offset = null)
{
}
public function processPending($limit = null, $offset = null) public function processPending($limit = null, $offset = null)
{ {
$conn = $this->_options['ownerTable']->getConnection(); $conn = $this->_options['ownerTable']->getConnection();
...@@ -115,9 +126,19 @@ class Doctrine_Search extends Doctrine_Plugin ...@@ -115,9 +126,19 @@ class Doctrine_Search extends Doctrine_Plugin
. ' IN (SELECT ' . $conn->quoteIdentifier($id) . ' IN (SELECT ' . $conn->quoteIdentifier($id)
. ' FROM ' . $conn->quoteIdentifier($this->_options['pluginTable']->getTableName()) . ' FROM ' . $conn->quoteIdentifier($this->_options['pluginTable']->getTableName())
. ' WHERE keyword IS NULL)'; . ' WHERE keyword IS NULL)';
$query = $conn->modifyLimitQuery($query, $limit, $offset);
$rows = $conn->fetchAll($query); $rows = $conn->fetchAll($query);
foreach ($rows as $row) {
$ids[] = $row[$id];
}
$conn->exec('DELETE FROM '
. $conn->quoteIdentifier($this->_options['pluginTable']->getTableName())
. ' WHERE ' . $conn->quoteIdentifier($id) . ' IN (' . implode(', ', $ids) . ')');
foreach ($rows as $row) { foreach ($rows as $row) {
foreach ($fields as $field) { foreach ($fields as $field) {
$data = $row[$field]; $data = $row[$field];
...@@ -131,8 +152,8 @@ class Doctrine_Search extends Doctrine_Plugin ...@@ -131,8 +152,8 @@ class Doctrine_Search extends Doctrine_Plugin
$index->position = $pos; $index->position = $pos;
$index->field = $field; $index->field = $field;
foreach ((array) $this->_options['ownerTable']->getIdentifier() as $id) { foreach ((array) $id as $identifier) {
$index->$id = $row[$id]; $index->$identifier = $row[$identifier];
} }
$index->save(); $index->save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment