YiiSolr
YiiSolr copied to clipboard
ASolrDocument->getSolrCriteria() incompatible with ASolrCriteria->__construct()
ASolrDocument.php at line 232 says: if(($c=$this->defaultScope())!==array() || $createIfNull) { $this->_solrCriteria=new ASolrCriteria($c);
but ASolrCriteria.php at line 13 says: public function __construct($data = null) { parent::__construct(); if ($data !== null) { foreach($data as $key => $value) { $this->{$key} = $value;
So, ASolrCriteria is expecting an array, but ASolrDocument is ensuring that an array is not passed -- unless creating automatically via $createIfNull in which case anything will be passed.
Really, ASolrCriteria inherits from PECL SolrQuery(), which allows a Solr (string) query to be passed to its constructor. This makes a certain amount of sense -- but of course YiiSolr does not support this as written.
It is confusing, and seemingly fatal, to do what ASolrCriteria currently does on creation, which is to set parameters when it has no parameters. (Even if this matches what CDbCriteria() does -- it has parameters.)