Commit 8482d419 by Van

DB

parent 545e1315
<?php
namespace Bolt\Extension\Appolo\Tourinsoft\Storage\Repository;
use Bolt\Storage\Repository;
class FluxRepository extends repository
{
}
\ No newline at end of file
<?php
namespace Bolt\Extension\Appolo\Tourinsoft\Storage\Schema\Table;
use Bolt\Storage\Database\Schema\Table\BaseTable;
class Flux extends BaseTable
{
/**
* Add columns to the table.
*/
protected function addColumns()
{
$this->table->addColumn('id', 'integer', ['autoincrement' => true]);
$this->table->addColumn('title', 'string', ['notnull' => true]);
$this->table->addColumn('code', 'string', ['notnull' => true]);
$this->table->addColumn('key', 'string', ['notnull' => true]);
$this->table->addColumn('contentType', 'string', ['notnull' => true]);
$this->table->addColumn('enabled', 'boolean', ['default' => false]);
$this->table->addColumn('createdAt', 'datetime', ['notnull' => true]);
$this->table->addColumn('updateAt', 'datetime', ['notnull' => true]);
}
/**
* Define the columns that require indexing.
*/
protected function addIndexes()
{
$this->table->addIndex(['enabled']);
}
/**
* Set the table's primary key.
*/
protected function setPrimaryKey()
{
$this->table->setPrimaryKey(['id']);
}
}
......@@ -3,8 +3,11 @@
namespace Bolt\Extension\Appolo\Tourinsoft;
use Bolt\Extension\Appolo\Tourinsoft\Controller\Backend\FluxController;
use Bolt\Extension\DatabaseSchemaTrait;
use Bolt\Extension\SimpleExtension;
use Bolt\Extension\StorageTrait;
use Bolt\Menu\MenuEntry;
use Silex\Application;
/**
* Tourinsoft extension class.
......@@ -13,6 +16,9 @@ use Bolt\Menu\MenuEntry;
*/
class TourinsoftExtension extends SimpleExtension
{
use StorageTrait;
use DatabaseSchemaTrait;
/**
* @return array
*/
......@@ -49,5 +55,35 @@ class TourinsoftExtension extends SimpleExtension
];
}
/**
* @param Application $app
*/
protected function registerServices(Application $app)
{
$this->extendDatabaseSchemaServices();
$this->extendRepositoryMapping();
parent::registerServices($app); // TODO: Change the autogenerated stub
}
/**
* @return array
*/
protected function registerExtensionTables()
{
return [
'tourinsoft_flux' => Storage\Schema\Table\Flux::class,
];
}
/**
* @return array
*/
protected function registerRepositoryMappings()
{
return [
'tourinsoft_flux' => [Storage\Entity\Flux::class => Storage\Repository\FluxRepository::class],
];
}
}
\ 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