Skip to content

Instantly share code, notes, and snippets.

@wms
Created June 12, 2014 15:59
Show Gist options
  • Save wms/cb6c32d7932b99a89ac8 to your computer and use it in GitHub Desktop.
Save wms/cb6c32d7932b99a89ac8 to your computer and use it in GitHub Desktop.
<?php
require 'vendor/autoload.php';
use polymer\core\App;
use polymer\data\Binding;
use lithium\core\Libraries;
Libraries::add('lithium');
Libraries::add('polymer', ['path' => '/home/warren/polymer/src/polymer']);
require 'models.php';
Binding::config(['default' => ['adapter' => 'Li3']]);
//var_dump(Widgets::first(['conditions' => ['_id' => "53970d085035c0bfe83399f8", 'deleted' => false]])->to('array'));
$app = new App();
$app->endpoint([
'name' => 'widgets',
'abstract' => true,
'binding' => [
'class' => 'Widgets',
]
]);
$app->endpoint([
'name' => 'widgets.index',
'url' => '',
'binding' => [
'method' => 'all',
]
]);
$app->endpoint([
'name' => 'widgets.view',
'url' => '/{:id}',
'binding' => [
'method' => 'find',
'params' => [
'first',
[
'conditions' => [
'_id' => '{:id}',
'deleted' => false
]
]
]
]
]);
$app->endpoint([
'name' => 'widgets.view.gizmos',
'url' => '/gizmos',
'binding' => [
'class' => 'Gizmos',
'method' => 'find',
'params' => [
'all',
[
'conditions' => [
'widget' => '{:id}'
]
]
]
]
]);
echo $app->run();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment