Skip to content

Instantly share code, notes, and snippets.

<?php
$router = new Phalcon\Mvc\Router(false);
$router->add('/:controller',
array(
'module' => 'common',
'controller' => 1
)
);
<?php
$di->set('db', function() use ($config) {
$connection = new \Phalcon\Db\Adapter\Pdo\Mysql(array(
"host" => "localhost",
"username" => "root",
"password" => "secret",
"dbname" => "test",
"options" => array(
<?php
$security = new Phalcon\Security();
for ($i = 8; $i < 12; $i++) {
$hash = $security->hash('a', $i);
$this->assertTrue($security->checkHash('a', $hash));
}
<?php
$user = new Users();
$profile = new Profile();
$user->name = "Mark";
$user->profile = $profile;
<?php echo $this->dialog->render("dialog", "Basic dialog", "This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.") ?>
<?php echo $this->widgets->create('dialog')->render(array(
"name" => "dialog",
"title" => "Basic dialog",
"content" => "This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon."
)) ?>
<?php
use Phalcon\Forms\Elements\Text as TextElement;
use Phalcon\Forms\Elements\TextArea as TextAreaElement;
use Phalcon\Validation\StringLength;
use Phalcon\Validation\PresenceOf;
class PostsController extends \Phalcon\Mvc\Controller
{
@phalcon
phalcon / test.php
Last active December 11, 2015 01:19
RoutePrefix: /posts
Route: Array
(
[0] => /edit/{id}
[methods] => Array
(
[0] => GET
[1] => POST
)
@phalcon
phalcon / models.php
Last active December 11, 2015 02:39
<?php
class Robots extends Phalcon\Mvc\Model
{
public function initialize()
{
$this->hasMany('id', 'RobotsParts', 'robots_id');
}
}
<?php
/**
* @RoutePrefix("/robots")
*/
class RobotsController extends Phalcon\Mvc\Controller
{
/**
* @Get("/")