Commit 211fab76 authored by Laurent's avatar Laurent
Browse files

Pellicule : Commit initial

parents
Pipeline #9097 failed with stages
vendor
*~
\ No newline at end of file
{
"require": {
"slim/slim": "4.*",
"slim/psr7": "^0.6.0",
"pbarroca/storm": "dev-master"
},
"repositories": [
{
"type": "vcs",
"url": "https://gitlab.com/patbator/storm"
}
],
"autoload": {
"psr-4": {
"Pellicule\\": "src"
}
}
}
This diff is collapsed.
create table if not exists `records` (
`id` int(11) unsigned not null auto_increment,
`ean` varchar(255),
`isbn` varchar(255),
`ark` varchar(255),
`created_at` datetime not null,
`updated_at` datetime not null,
primary key (`id`),
key `ean` (`ean`),
key `isbn` (`isbn`),
key `ark` (`ark`)
) engine=Aria default charset=utf8;
create table if not exists `media` (
`id` int(11) unsigned not null auto_increment,
`record_id` int(11) unsigned not null,
`type` varchar(255) not null,
`url` varchar(255) not null,
`provider` varchar(255) not null,
`created_at` datetime not null,
`updated_at` datetime not null,
primary key (`id`),
key `record_id` (`record_id`)
) engine=Aria default charset=utf8;
<?php
use Psr\Http\Message\ServerRequestInterface as Request;
use Psr\Http\Server\RequestHandlerInterface as RequestHandler;
use Slim\Psr7\Response;
use Slim\Factory\AppFactory;
require __DIR__ . '/../vendor/autoload.php';
$app = AppFactory::create();
$app->add(function(Request $request, RequestHandler $handler)
{
\Storm\Persistence\Connections::getInstance()
->setDefault(new \Storm\Persistence\Mysqli\Connection(new \Storm\Persistence\Configuration(['database' => '',
'user' => '',
'pass' => '',
'host' => ''])));
\Storm\Model\Loader::defaultTo(\Storm\Persistence\SqlStrategy::class);
return $handler->handle($request);
});
$app->get('/', function (Request $request, Response $response, $args) {
$response->getBody()->write("Coucou les amis");
foreach(\Pellicule\Models\Record::findAll() as $record) {
$response->getBody()->write('<p>' . $record->getIsbn() .','. $record->getEan() . '</p>');
}
return $response;
});
$app->run();
\ No newline at end of file
<?php
namespace Pellicule\Models;
use \Storm\Model\ModelAbstract;
class Record extends ModelAbstract {
protected
$_table_name = 'records';
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment