public function setUp() { $this->schema = array('field_a' => String::create('field_a'), 'field_b' => String::create('field_b')->filter('trim')); $this->connection = new MemoryConnection(array('name' => 'test_connection')); $this->connection->setCollectionData('test_collection', array(array('field_a' => 'a1', 'field_b' => 'b1'), array('field_a' => 'a2', 'field_b' => 'b2'), array('field_a' => 'a3', 'field_b' => 'b3'))); $this->collection = new Collection(array('name' => 'TestCollection', 'schema' => $this->schema, 'connection' => $this->connection)); }
public function setUp() { $connection = $this->getConnection(); $options = array('name' => 'test_user', 'schema' => array('first_name' => String::create('first_name'), 'last_name' => String::create('last_name')), 'connection' => $connection); $this->collection = new Collection($options); $connection->factory($this->collection); $connection->remove('test_user'); foreach ($this->fixtures as $row) { $model = $this->collection->newInstance(); $model->set($row); $model->save(); } }
<?php use Norm\Schema\String; use Norm\Schema\Password; use Norm\Schema\Date; return array('schema' => array('name' => String::create('name')->set('list-column', true), 'password' => Password::create('password')->set('list-column', true), 'date' => Date::create('date')->set('list-column', true)->format('input', function () { $app = App::getInstance(); return $app->response->template('_migrate/show'); })));
<?php /** * Bono App Configuration * * @category PHP_Framework * @package Bono * @author Ganesha <*****@*****.**> * @copyright 2013 PT Sagara Xinix Solusitama * @license https://raw.github.com/xinix-technology/bono/master/LICENSE MIT * @version 0.10.0 * @link http://xinix.co.id/products/bono */ use Norm\Schema\String; use Norm\Schema\Password; return array('application' => array('title' => 'Jobs', 'subtitle' => 'One great application'), 'bono.salt' => 'please change this', 'bono.providers' => array('\\Norm\\Provider\\NormProvider' => array('datasources' => array('mongo' => array('driver' => '\\Norm\\Connection\\MongoConnection', 'database' => 'bono')), 'collections' => array('mapping' => array('User' => array('schema' => array('username' => String::create('username')->filter('trim|required|unique:User,username'), 'password' => Password::create('password')->filter('trim|confirmed|salt'), 'email' => String::create('email')->filter('trim|required|unique:User,email'), 'first_name' => String::create('first_name')->filter('trim|required'), 'last_name' => String::create('last_name')->filter('trim|required')))))), '\\Xinix\\Migrate\\Provider\\MigrateProvider' => array(), '\\ROH\\Jobs\\Provider\\JobProvider' => array('spools' => array('cron' => array('driver' => 'cron')))), 'bono.middlewares' => array('\\Bono\\Middleware\\StaticPageMiddleware' => null, '\\Bono\\Middleware\\ControllerMiddleware' => array('default' => '\\Norm\\Controller\\NormController', 'mapping' => array('/user' => null, '/jobs' => '\\ROH\\Jobs\\Controller\\JobController')), '\\Bono\\Middleware\\ContentNegotiatorMiddleware' => array('extensions' => array('json' => 'application/json'), 'views' => array('application/json' => '\\Bono\\View\\JsonView')), '\\Bono\\Middleware\\NotificationMiddleware' => null, '\\Bono\\Middleware\\SessionMiddleware' => null));
<?php use Norm\Schema\String; return array('schema' => array('title' => String::create('title')->set('list-column', true), 'description' => String::create('description')->set('list-column', true), 'group' => String::create('group')->set('list-column', true), 'date' => String::create('date')->set('list-column', true)));
<?php use Norm\Schema\String; use Norm\Schema\Password; return array('schema' => array('first_name' => String::create('first_name')->filter('trim|required')->set('list-column', true), 'last_name' => String::create('last_name')->filter('trim|required')->set('list-column', true), 'username' => String::create('username')->filter('trim|required|unique:User,username')->set('list-column', true), 'password' => Password::create('password')->filter('trim|confirmed|salt'), 'email' => String::create('email')->filter('trim|required|unique:User,email')->set('list-column', true), 'birthday' => String::create('birthday')->filter('trim'), 'gender' => String::create('gender')->filter('trim'), 'mobile_phone' => String::create('mobile_phone')->filter('trim'), 'address' => String::create('address')->filter('trim')));
</div> <div class="span-12"> <label>README</label> <hr> <?php if (empty($entry['readme'])) { ?> <span><?php echo \Norm\Schema\String::create()->format('readOnly', 'No readme avaliable'); ?> </span> <?php } else { ?> <pre class="readme" style="display:none"><?php echo \Norm\Schema\String::create()->format('plain', htmlentities(base64_decode($entry['readme']))); ?> </pre> <div id="readme"></div> <?php } ?> </div> </div> </div> </div> </div> </div> </main> <script type="text/javascript" src="<?php
<?php /** * Bono App Configuration * * @category PHP_Framework * @package Bono * @author Ganesha <*****@*****.**> * @copyright 2013 PT Sagara Xinix Solusitama * @license https://raw.github.com/xinix-technology/bono/master/LICENSE MIT * @version 0.10.0 * @link http://xinix.co.id/products/bono */ use Norm\Schema\String; use Norm\Schema\Password; use Norm\Schema\Text; use Norm\Schema\NormArray; return array('bono.salt' => 'please change this', 'bono.providers' => array('\\Norm\\Provider\\NormProvider' => array('datasources' => array('mongo' => array('driver' => '\\Norm\\Connection\\MongoConnection', 'database' => 'xeekee')), 'collections' => array('mapping' => array('User' => array('schema' => array('username' => String::create('username')->filter('trim|required|unique:User,username'), 'password' => Password::create('password')->filter('trim|confirmed|salt'), 'email' => String::create('email')->filter('trim|required|unique:User,email'), 'first_name' => String::create('first_name')->filter('trim|required'), 'last_name' => String::create('last_name')->filter('trim|required'))), 'Workspace' => array('schema' => array('path' => String::create('path')->filter('trim|required'), 'title' => String::create('title')->filter('trim|required'), 'description' => Text::create('description')->filter('trim'), '$members' => NormArray::create('$members')))))), '\\Xinix\\Migrate\\Provider\\MigrateProvider' => array(), '\\Xeekee\\Provider\\XeekeeProvider'), 'bono.middlewares' => array('\\Xeekee\\Middleware\\XeekeeMiddleware' => array('root' => 'home/anu'), '\\Bono\\Middleware\\StaticPageMiddleware' => null, '\\Xeekee\\Middleware\\ShowcaseMiddleware' => array(), '\\Bono\\Middleware\\ControllerMiddleware' => array('default' => '\\Norm\\Controller\\NormController', 'mapping' => array('/admin/user' => null, '/admin/workspace' => null)), '\\Bono\\Middleware\\ContentNegotiatorMiddleware' => array('extensions' => array('json' => 'application/json'), 'views' => array('application/json' => '\\Bono\\View\\JsonView')), '\\ROH\\BonoAuth\\Middleware\\AuthMiddleware' => array('driver' => '\\ROH\\BonoAuth\\Driver\\OAuth', 'debug' => true, 'baseUrl' => 'http://192.168.1.99/internal/account/www/index.php', 'authUrl' => '/oauth/auth', 'tokenUrl' => '/oauth/token', 'revokeUrl' => '/oauth/revoke', 'clientId' => '5413c7cdb75868b3278b4567.client.account.xinix.co.id', 'clientSecret' => 'b96a2b17d92cd6debff65c21d94858a5', 'redirectUri' => 'http://192.168.1.99/internal/xeekee/www/index.php/login', 'scope' => 'user'), '\\Bono\\Middleware\\NotificationMiddleware' => null, '\\Bono\\Middleware\\SessionMiddleware' => null), 'bono.theme' => array('class' => '\\ROH\\Theme\\BootstrapTheme', 'overwrite' => true, 'options' => array('title' => 'XeeKee', 'menu' => array())));
public function schema() { Filter::register('can_access', function ($value, $entry, $args) { if (empty($value)) { return $value; } if ($args[0] === 'dir') { if (!is_dir($value) && !@mkdir($value, 0755, true)) { throw new \Exception('Directory is not exists'); } if (!is_readable($value)) { throw new \Exception('Directory is not readable'); } if (!is_writable($value)) { throw new \Exception('Directory is not writable'); } } else { @mkdir(dirname($value), 0755, true); if (!@touch($value)) { throw new \Exception('File is not exists'); } if (!is_readable($value)) { throw new \Exception('File is not readable'); } if (!is_writable($value)) { throw new \Exception('File is not writable'); } } return $value; }); return array('name' => String::create('name')->filter('required'), 'expression' => String::create('expression')->filter('required'), 'command' => String::create('command')->filter('required'), 'working_dir' => String::create('working_dir')->filter('can_access:dir'), 'stdout' => String::create('stdout')->filter('can_access:file'), 'stderr' => String::create('stderr')->filter('can_access:file'), 'next_run' => DateTime::create('next_run')); }
<?php /** * Bono App Configuration * * @category PHP_Framework * @package Bono * @author Ganesha <*****@*****.**> * @copyright 2013 PT Sagara Xinix Solusitama * @license https://raw.github.com/xinix-technology/bono/master/LICENSE MIT * @version 0.10.0 * @link http://xinix.co.id/products/bono */ use Norm\Schema\String; use Norm\Schema\Password; use Norm\Schema\Integer; return array('application' => array('title' => 'Bono Application', 'subtitle' => 'One great application'), 'bono.salt' => 'please change this', 'bono.providers' => array('Norm\\Provider\\NormProvider' => array('datasources' => array('filedb' => array('driver' => 'ROH\\FDB\\Connection', 'dataDir' => '../data')), 'collections' => array('default' => array('observers' => array('Norm\\Observer\\Timestampable' => null)), 'mapping' => array('User' => array('schema' => array('username' => String::create('username')->filter('trim|required|unique:User,username'), 'password' => Password::create('password')->filter('trim|confirmed|salt'), 'email' => String::create('email')->filter('trim|required|unique:User,email'), 'first_name' => String::create('first_name')->filter('trim|required'), 'last_name' => String::create('last_name')->filter('trim|required'))), 'Item' => array('schema' => array('code' => String::create('code')->filter('trim|required|unique:Item,code'), 'name' => String::create('name')->filter('trim|required'), 'price' => Integer::create('price')))))), 'Xinix\\Migrate\\Provider\\MigrateProvider' => array(), 'ROH\\FDB\\Provider\\FDBProvider'), 'bono.middlewares' => array('Bono\\Middleware\\StaticPageMiddleware' => null, 'Bono\\Middleware\\ControllerMiddleware' => array('default' => 'Norm\\Controller\\NormController', 'mapping' => array('/user' => null, '/item' => null)), 'Bono\\Middleware\\ContentNegotiatorMiddleware' => array('extensions' => array('json' => 'application/json'), 'views' => array('application/json' => 'Bono\\View\\JsonView')), 'Bono\\Middleware\\NotificationMiddleware' => null, 'Bono\\Middleware\\SessionMiddleware' => null));
<?php use Norm\Schema\String; use Norm\Schema\Password; return array('application' => array('title' => 'Xinix Showcase', 'subtitle' => 'A Comfy Place to Show Your Cases'), 'bono.salt' => 'e4d692e3ffe441649afa4c89c907a4f95653f89f', 'bono.providers' => array('\\Norm\\Provider\\NormProvider' => array('datasources' => array('mongo' => array('driver' => '\\Norm\\Connection\\MongoConnection', 'database' => 'showcase')), 'collections' => array('mapping' => array('User' => array('schema' => array('username' => String::create('username')->filter('trim|required|unique:User,username'), 'password' => Password::create('password')->filter('trim|confirmed|salt'), 'email' => String::create('email')->filter('trim|required|unique:User,email'), 'first_name' => String::create('first_name')->filter('trim|required'), 'last_name' => String::create('last_name')->filter('trim|required'))), 'Git' => array('observers' => array('App\\Observer\\ShowcaseObserver' => array()), 'schema' => array('git' => String::create('git')->filter('trim|required'), 'author' => String::create('author')->set('hidden', true), 'repo' => String::create('repo')->set('hidden', true), 'description' => String::create('description')->set('hidden', true), 'fork' => String::create('fork')->set('hidden', true), 'star' => String::create('star')->set('hidden', true), 'version' => String::create('version')->set('hidden', true), 'readme' => String::create('readme')->set('hidden', true), 'slug' => String::create('readme')->set('hidden', true)))))), '\\App\\Provider\\AppProvider'), 'bono.middlewares' => array('\\Bono\\Middleware\\ControllerMiddleware' => array('default' => '\\Norm\\Controller\\NormController', 'mapping' => array('/user' => null, '/git' => null, '/menu' => null, '/packages' => 'App\\Controller\\PackageController')), '\\Bono\\Middleware\\ContentNegotiatorMiddleware' => array('extensions' => array('json' => 'application/json'), 'views' => array('application/json' => '\\Bono\\View\\JsonView')), '\\Bono\\Middleware\\NotificationMiddleware' => null, '\\Bono\\Middleware\\SessionMiddleware' => null), 'bono.theme' => array('class' => '\\Xinix\\Theme\\NakedTheme', 'override' => true));