Skip to content

Instantly share code, notes, and snippets.

<?php
namespace Knode\Dao\Sql;
$di = new \Phalcon\Di\FactoryDefault();
$di->set('db', function(){
$config = array(
"host" => "localhost",
<?php
$routes = array(
'/',
'/index',
'/index/index',
'/index/test',
'/test',
'/test/index/',
'/test',

Install Phalcon and check that the extension is loaded in phpinfo()

Open C:\Windows\System32\drivers\etc\hosts and added:

127.0.0.1       my.store

Open C:\xampp\apache\conf\extra\httpd-vhosts.conf and uncommented:

class Registry {
private $_data = array();
public function set($x, $d)
{
$this->_data[$x] = $d;
}
public function get($x)
<?php
error_reporting(E_ALL);
$di = new Phalcon\DI();
$di->set('modelsManager', function() {
return new Phalcon\Mvc\Model\Manager();
}, true);
if [ -f Makefile ]; then
make clean
phpize --clean
fi
export CC="gcc"
export CFLAGS="-march=native -mtune=native -O2 -fno-delete-null-pointer-checks -finline-functions"
echo "int main() {}" > t.c
gcc $CFLAGS t.c -o t 2> t.t
<?php
/* desc artists_similar;
+-------------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------------------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| artists_id | int(10) unsigned | NO | MUL | NULL | |
| similar_artist_id | int(10) unsigned | NO | | NULL | |
+-------------------+------------------+------+-----+---------+----------------+
<?php
//With the default lifetime
$sidebar = $this->viewCache->start("sidebar");
if ($sidebar === null) {
echo '<!-- some sidebar code here -->';
$this->viewCache->save();
} else {
echo $sidebar;
}
<?php
class MyManager extends Phalcon\Mvc\Model\Manager
{
protected $_cache;
public function setCache($cache)
{
$this->_cache = $cache;
<?php
$robots = new Robots();
$modelsManager = $di->get('modelsManager');
$relations = $modelsManager->getRelations('Robots');
foreach ($relations as $relation) {
$options = $relation->getOptions();