Created
September 2, 2018 07:55
-
-
Save nagaho/b62f6be070674fc8aec645b0cd5bc09b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env php | |
<?php | |
$di = new Phalcon\Di(); | |
$di->set('db', function () { | |
return new Phalcon\Db\Adapter\Pdo\Mysql( | |
['host' => 'localhost', 'username' => 'root', 'password' => 'pass', 'dbname' => 'test'] | |
); | |
}); | |
$di->set('modelsMetadata', Phalcon\Mvc\Model\Metadata\Memory::class); | |
$di->set('modelsManager', Phalcon\Mvc\Model\Manager::class); | |
$user = new User(); | |
$user->id = mt_rand(1, 10); | |
$user->name = uniqid(); | |
$user->create(); | |
class User extends Phalcon\Mvc\Model | |
{ | |
public function initialize() | |
{ | |
$this->setSource('users'); | |
} | |
} |
Author
nagaho
commented
Sep 2, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment