. */ /** * Doctrine_Template_Searchable * * @author Konsta Vesterinen * @package Doctrine * @subpackage Template * @license http://www.opensource.org/licenses/lgpl-license.php LGPL * @version $Revision$ * @link www.phpdoctrine.com * @since 1.0 */ class Doctrine_Template_Searchable extends Doctrine_Template { public function __construct(array $options) { $this->_plugin = new Doctrine_Search($options); } public function getPlugin() { return $this->_plugin; } public function setUp() { $id = $this->_table->getIdentifier(); $name = $this->_table->getComponentName(); $className = $this->_plugin->getOption('className'); if (strpos($className, '%CLASS%') !== false) { $this->_plugin->setOption('className', str_replace('%CLASS%', $name, $className)); $className = $this->_plugin->getOption('className'); } $this->_plugin->setOption('resource', $this->_table); $this->_plugin->buildDefinition(); $this->hasMany($className, array('local' => $id, 'foreign' => $id)); $this->addListener(new Doctrine_Search_Listener($this->_plugin)); } public function batchUpdateIndex($limit = null, $offset = null) { $this->_plugin->batchUpdateIndex($limit, $offset); } }