Sphinx 狮身人面像;Phalcon\Mvc\Model
我有一个基于MySQL协议运行的Sphinx搜索引擎,我使用Phalcon\Db\Adapter\Pdo\MySQL连接到它。Sphinx表作为模型实现 当我尝试选择(使用SpinxQL)时,很明显,当数据库适配器试图提取针对SpinxQL中不受支持且不存在的表运行查询的表元数据时,我会得到一个错误。说明如何手动分配元数据的文档中有一个变通方法。。。但由于天生懒惰,我想尝试自动化元数据生成 我假设元数据是由数据库适配器生成的,可能是在getColumnDefinition()或其他(???)之后的实例上调用getColumnsList()的结果。这是我的假设正确吗?我想要的是扩展Phalcon\Db\Adapter\Pdo\Mysql并覆盖这些方法以与Sphinx兼容Sphinx 狮身人面像;Phalcon\Mvc\Model,sphinx,phalcon,Sphinx,Phalcon,我有一个基于MySQL协议运行的Sphinx搜索引擎,我使用Phalcon\Db\Adapter\Pdo\MySQL连接到它。Sphinx表作为模型实现 当我尝试选择(使用SpinxQL)时,很明显,当数据库适配器试图提取针对SpinxQL中不受支持且不存在的表运行查询的表元数据时,我会得到一个错误。说明如何手动分配元数据的文档中有一个变通方法。。。但由于天生懒惰,我想尝试自动化元数据生成 我假设元数据是由数据库适配器生成的,可能是在getColumnDefinition()或其他(???)之后
提前感谢您的建议 好的,您需要重写至少两个方法才能使其工作,下面的类可以工作:
<?php
class SphinxQlAdapter extends Phalcon\Db\Adapter\Pdo\Mysql implements Phalcon\Db\AdapterInterface
{
/**
* This method checks if a table exists
*
* @param string $table
* @param string $schema
* @return boolean
*/
public function tableExists($table, $schema=null)
{
}
/**
* This method describe the table's columns returning an array of
* Phalcon\Db\Column
*
* @param string $table
* @param string $schema
* @return Phalcon\Db\ColumnInterface[]
*/
public function describeColumns($table, $schema=null)
{
}
}
$di->set('db', function(){
return new SphinxQlAdapter(
//...
);
});