/** * Constructs a new instance for a model */ public function __construct($search, $instance) { parent::__construct($search); if ($search->getParameter('models')->get(get_class($instance), null) == null) { throw new sfLuceneIndexerException(sprintf('Model "%s" is not registered.', get_class($instance))); } $this->instance = $instance; }
public function __construct($search, $module, $action) { parent::__construct($search); $this->module = $module; $this->action = $action; $config = sfConfig::get('sf_app_dir') . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . $module . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'search.yml'; include sfConfigCache::getInstance()->checkConfig($config); if (!isset($actions[$this->getSearch()->getParameter('name')][$action])) { throw new sfLuceneIndexerException('Specified action is not registered for indexing'); } $this->properties = $actions[$this->getSearch()->getParameter('name')][$action]; }
/** * Constructs a new instance for a model */ public function __construct($search, $instance) { parent::__construct($search); $models = $search->getParameter('models')->getAll(); $this->model_name = false; if (!is_object($instance)) { throw new sfLuceneIndexerException('The instance is not an object'); } // fix class inheritance foreach (array_keys($models) as $model) { if ($instance instanceof $model) { $this->model_name = $model; break; } } if (!$this->model_name) { throw new sfLuceneIndexerException(sprintf('Model "%s" is not registered.', get_class($instance))); } $this->instance = $instance; }