The table Modules
has 3 columns.
moduleid smallint(5) auto_increment primary key
parentid smallint(5)
title varchar(50)
$modules = $this->modelsManager
->createBuilder()
->from('Modules')
->inWhere('parentid',[0,1])
->getQuery()
->execute();
var_dump($modules);
When i used inWhere() , 502 Bad Way
help plz.
centos 6.4 + php 5.4.15 + nginx + phalcon 1.1.0
the routes.php like this:
$router = new Phalcon\Mvc\Router();
$router->add(
"/:controller/:action/:int/:params",
array(
'controller' => 1,
'action' => 2,
'id' => 3,
'params' => 4
)
);
return $router;
service.php like this:
$di->set('db', function() use ($config) {
//$eventsManager = new \Phalcon\Events\Manager();
//$logger = new \Phalcon\Logger\Adapter\File(__DIR__ . "/../logs/db.log");
$connection = new DbAdapter(array(
'host' => $config->database->host,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->dbname
));
/*$eventsManager->attach('db', function($event, $connection) use ($logger) {
if ($event->getType() == 'afterQuery') {
$logger->log($connection->getSQLStatement(), \Phalcon\Logger::INFO);
}
});*/
//$connection->setEventsManager($eventsManager);
$connection->query("SET NAMES 'UTF8'");
return $connection;
});
$di->set('modelsManager', function(){
return new \Phalcon\Mvc\Model\Manager();
});
$di->set('modelsMetadata', function() use ($config) {
return new \Phalcon\Mvc\Model\Metadata\Memory();
}, true);
nginx.conf like this:
server {
listen 80;
server_name mvc.dibiao.com;
index index.php index.html index.htm;
set $root_path '/data/www/coremvc';
root $root_path;
try_files $uri $uri/ @rewrite;
location @rewrite {
rewrite ^/(.*)$ /index.php?_url=/$1;
}
location ~ \.php {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index /index.php;
include fastcgi_params;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
location ~* ^/(css|img|js|flv|swf|download)/(.+)$ {
root $root_path;
}
}