I've implemented my own DB adapter extending \Phalcon\Db\Adapter. And it works fine untill I try to set an event manager instance for it. Regardless of what events are listened or even clear instance of \Phalcon\Events\Manager().
All the time I call EventsManager::fire() my apache crashes.
Here is an example:
<?php
namespace Phalcon\Db\Adapter;
use Phalcon\Db\Exception;
class Sybase extends \Phalcon\Db\Adapter implements \Phalcon\Db\AdapterInterface
{
public function query($sqlStatement, $bindParams=null, $bindTypes=null)
{
/**
* Execute the beforeQuery event if a EventsManager is available
*/
if (is_object($this->_eventsManager)) {
$this->_sqlStatement = $sqlStatement;
$this->_sqlVariables = $bindParams;
$this->_sqlBindTypes = $bindTypes;
if ($this->_eventsManager->fire("db:beforeQuery", $this, $bindParams) == false) {
return false;
}
}
$sql = $this->getEmulatedBindQuery($sqlStatement, $bindParams, $bindTypes);
$statement = sybase_query($sql, $this->_connection);
if ($statement === false) {
throw new Exception('Query "' . $sql . '" caused following error: "' . sybase_get_last_message() . '"');
} else {
/**
* Execute the afterQuery event if a EventsManager is available
*/
if (is_object($this->_eventsManager)) {
$this->_eventsManager->fire("db:afterQuery", $this, $bindParams);
}
return new \Phalcon\Db\Result\Sybase($this, $statement, $sql);
}
}
Versions: PHP 5.5.10, Apache 2.4.9.0, Phalcon 1.3.0
I would be grateful for any help.