Add categories template and ok to add one category in db, next modify and delete.

This commit is contained in:
JBthePenguin 2021-06-03 02:21:52 +02:00
parent 4448a9bde1
commit 2f9b57a842
7 changed files with 97 additions and 0 deletions

24
src/lib/Category.php Normal file
View file

@ -0,0 +1,24 @@
<?php
namespace Garradin\Plugin\Materiels;
use Garradin\Entity;
use Garradin\DB;
class Category extends Entity
{
const TABLE = 'plugin_materiels_category';
protected $id;
protected $name;
protected $_types = [
'id' => 'int',
'name' => 'string',
];
static public function listAll(): array
{
return DB::getInstance()->get('SELECT id, name FROM plugin_materiels_category ORDER BY name COLLATE NOCASE;');
}
}