Fixed Consistency for routes and names
This commit is contained in:
parent
2db8d5cd06
commit
9ea0224880
10 changed files with 157 additions and 56 deletions
|
|
@ -673,20 +673,29 @@ catalyst_auth:
|
||||||
- id: item_pricing.update
|
- id: item_pricing.update
|
||||||
label: Update
|
label: Update
|
||||||
|
|
||||||
- id: test_list
|
- id: entity_list
|
||||||
label: TestTypes
|
label: EntityTypes
|
||||||
acls:
|
acls:
|
||||||
- id: test.menu
|
- id: entity.menu
|
||||||
label: Menu
|
label: Menu
|
||||||
- id: test.add
|
- id: entity.add
|
||||||
label: Add
|
label: Add
|
||||||
- id: test.update
|
- id: entity.update
|
||||||
label: Update
|
label: Update
|
||||||
- id: test.delete
|
- id: entity.delete
|
||||||
label: Delete
|
label: Delete
|
||||||
- id: test.list
|
- id: entity.list
|
||||||
label: List
|
label: List
|
||||||
|
|
||||||
|
- id: send_EDA
|
||||||
|
label: sendeda
|
||||||
|
acls:
|
||||||
|
- id: eda.menu
|
||||||
|
label: Menu
|
||||||
|
- id: eda.update
|
||||||
|
label: Update
|
||||||
|
- id: eda.list
|
||||||
|
label: List
|
||||||
|
|
||||||
|
|
||||||
api:
|
api:
|
||||||
|
|
|
||||||
|
|
@ -307,6 +307,11 @@ catalyst_menu:
|
||||||
label: Item Pricing
|
label: Item Pricing
|
||||||
parent: item
|
parent: item
|
||||||
|
|
||||||
- id: test_list
|
- id: entity_list
|
||||||
acl: test.menu
|
acl: entity.menu
|
||||||
label: TestTypes
|
label: EntityTypes
|
||||||
|
|
||||||
|
- id: send_EDA
|
||||||
|
acl: eda.menu
|
||||||
|
label: Notifs
|
||||||
|
parent: entity_list
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,34 @@
|
||||||
test_list:
|
entity_list:
|
||||||
path: /test
|
path: /test
|
||||||
controller: App\Controller\EntityController::index
|
controller: App\Controller\EntityController::index
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
|
|
||||||
test_type_rows:
|
entity_rows:
|
||||||
path: /test/rowdata
|
path: /test/rowdata
|
||||||
controller: App\Controller\EntityController::datatableRows
|
controller: App\Controller\EntityController::datatableRows
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
test_type_add_form:
|
entity_add_form:
|
||||||
path: /test/newform
|
path: /test/newform
|
||||||
controller: App\Controller\EntityController::addForm
|
controller: App\Controller\EntityController::addForm
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
|
|
||||||
test_type_add_submit:
|
entity_add_submit:
|
||||||
path: /test
|
path: /test
|
||||||
controller: App\Controller\EntityController::addSubmit
|
controller: App\Controller\EntityController::addSubmit
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
test_type_update_form:
|
entity_update_form:
|
||||||
path: /test/{id}
|
path: /test/{id}
|
||||||
controller: App\Controller\EntityController::updateForm
|
controller: App\Controller\EntityController::updateForm
|
||||||
methods: [GET]
|
methods: [GET]
|
||||||
|
|
||||||
test_type_update_submit:
|
entity_update_submit:
|
||||||
path: /test/{id}
|
path: /test/{id}
|
||||||
controller: App\Controller\EntityController::updateSubmit
|
controller: App\Controller\EntityController::updateSubmit
|
||||||
methods: [POST]
|
methods: [POST]
|
||||||
|
|
||||||
test_type_delete:
|
entity_delete:
|
||||||
path: /test/{id}
|
path: /test/{id}
|
||||||
controller: App\Controller\EntityController::deleteSubmit
|
controller: App\Controller\EntityController::deleteSubmit
|
||||||
methods: [DELETE]
|
methods: [DELETE]
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Controller;
|
namespace App\Controller;
|
||||||
|
|
||||||
use App\Entity\Test;
|
use App\Entity\Entity;
|
||||||
use Doctrine\ORM\Query;
|
use Doctrine\ORM\Query;
|
||||||
use Doctrine\ORM\QueryBuilder;
|
use Doctrine\ORM\QueryBuilder;
|
||||||
use Doctrine\ORM\EntityManagerInterface;
|
use Doctrine\ORM\EntityManagerInterface;
|
||||||
|
|
@ -21,8 +21,8 @@ use Catalyst\MenuBundle\Annotation\Menu;
|
||||||
class EntityController extends Controller{
|
class EntityController extends Controller{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Menu(selected="test_list")
|
* @Menu(selected="entity_list")
|
||||||
* @IsGranted("test.list")
|
* @IsGranted("entity.list")
|
||||||
*/
|
*/
|
||||||
public function index ()
|
public function index ()
|
||||||
{
|
{
|
||||||
|
|
@ -30,14 +30,14 @@ class EntityController extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Menu(selected="test_list")
|
* @Menu(selected="entity_list")
|
||||||
* @IsGranted("test.add")
|
* @IsGranted("entity.add")
|
||||||
*/
|
*/
|
||||||
public function addForm()
|
public function addForm()
|
||||||
{
|
{
|
||||||
$test = new Test();
|
$entity = new Entity();
|
||||||
$params = [
|
$params = [
|
||||||
'obj' => $test,
|
'obj' => $entity,
|
||||||
'mode' => 'create',
|
'mode' => 'create',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -46,11 +46,11 @@ class EntityController extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @IsGranted("test.add")
|
* @IsGranted("entity.add")
|
||||||
*/
|
*/
|
||||||
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
public function addSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator)
|
||||||
{
|
{
|
||||||
$test = new Test();
|
$test = new Entity();
|
||||||
|
|
||||||
$this->setObject($test, $req);
|
$this->setObject($test, $req);
|
||||||
|
|
||||||
|
|
@ -86,13 +86,13 @@ class EntityController extends Controller{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Menu(selected="test_list")
|
* @Menu(selected="entity_list")
|
||||||
* @IsGranted("test.update")
|
* @IsGranted("entity.update")
|
||||||
*/
|
*/
|
||||||
public function updateForm($id, EntityManagerInterface $em, Test $test)
|
public function updateForm($id, EntityManagerInterface $em, Entity $e)
|
||||||
{
|
{
|
||||||
$params = [];
|
$params = [];
|
||||||
$params['obj'] = $test;
|
$params['obj'] = $e;
|
||||||
$params['mode'] = 'update';
|
$params['mode'] = 'update';
|
||||||
|
|
||||||
// response
|
// response
|
||||||
|
|
@ -100,14 +100,14 @@ class EntityController extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @IsGranted("test.update")
|
* @IsGranted("entity.update")
|
||||||
*/
|
*/
|
||||||
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, Test $test)
|
public function updateSubmit(Request $req, EntityManagerInterface $em, ValidatorInterface $validator, Entity $e)
|
||||||
{
|
{
|
||||||
$this->setObject($test, $req);
|
$this->setObject($e, $req);
|
||||||
|
|
||||||
// validate
|
// validate
|
||||||
$errors = $validator->validate($test);
|
$errors = $validator->validate($e);
|
||||||
|
|
||||||
// initialize error list
|
// initialize error list
|
||||||
$error_array = [];
|
$error_array = [];
|
||||||
|
|
@ -136,12 +136,12 @@ class EntityController extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @IsGranted("test.delete")
|
* @IsGranted("entity.delete")
|
||||||
*/
|
*/
|
||||||
public function deleteSubmit(EntityManagerInterface $em, Test $test)
|
public function deleteSubmit(EntityManagerInterface $em, Entity $entity)
|
||||||
{
|
{
|
||||||
// delete this object
|
// delete this object
|
||||||
$em->remove($test);
|
$em->remove($entity);
|
||||||
$em->flush();
|
$em->flush();
|
||||||
|
|
||||||
// response
|
// response
|
||||||
|
|
@ -150,7 +150,7 @@ class EntityController extends Controller{
|
||||||
$response->send();
|
$response->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setObject(Test $obj, Request $req)
|
protected function setObject(Entity $obj, Request $req)
|
||||||
{
|
{
|
||||||
// set and save values
|
// set and save values
|
||||||
$obj->setItem($req->request->get('item'))
|
$obj->setItem($req->request->get('item'))
|
||||||
|
|
@ -168,13 +168,13 @@ class EntityController extends Controller{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @IsGranted("test.list")
|
* @IsGranted("entity.list")
|
||||||
*/
|
*/
|
||||||
public function datatableRows(Request $req)
|
public function datatableRows(Request $req)
|
||||||
{
|
{
|
||||||
// get query builder
|
// get query builder
|
||||||
$qb = $this->getDoctrine()
|
$qb = $this->getDoctrine()
|
||||||
->getRepository(Test::class)
|
->getRepository(Entity::class)
|
||||||
->createQueryBuilder('q');
|
->createQueryBuilder('q');
|
||||||
|
|
||||||
// get datatable params
|
// get datatable params
|
||||||
|
|
@ -237,10 +237,10 @@ class EntityController extends Controller{
|
||||||
];
|
];
|
||||||
|
|
||||||
// add crud urls
|
// add crud urls
|
||||||
if ($this->isGranted('test.update'))
|
if ($this->isGranted('entity.update'))
|
||||||
$row['meta']['update_url'] = $this->generateUrl('test_type_update_form', ['id' => $row['id']]);
|
$row['meta']['update_url'] = $this->generateUrl('entity_update_form', ['id' => $row['id']]);
|
||||||
if ($this->isGranted('test.delete'))
|
if ($this->isGranted('entity.delete'))
|
||||||
$row['meta']['delete_url'] = $this->generateUrl('test_type_delete', ['id' => $row['id']]);
|
$row['meta']['delete_url'] = $this->generateUrl('entity_delete', ['id' => $row['id']]);
|
||||||
|
|
||||||
$rows[] = $row;
|
$rows[] = $row;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
/**
|
/**
|
||||||
* @ORM\Entity(repositoryClass=TestRepository::class)
|
* @ORM\Entity(repositoryClass=TestRepository::class)
|
||||||
*/
|
*/
|
||||||
class Test
|
class Entity
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @ORM\Id
|
* @ORM\Id
|
||||||
37
src/Migrations/Version20241023070137.php
Normal file
37
src/Migrations/Version20241023070137.php
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace DoctrineMigrations;
|
||||||
|
|
||||||
|
use Doctrine\DBAL\Schema\Schema;
|
||||||
|
use Doctrine\Migrations\AbstractMigration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Auto-generated Migration: Please modify to your needs!
|
||||||
|
*/
|
||||||
|
final class Version20241023070137 extends AbstractMigration
|
||||||
|
{
|
||||||
|
public function getDescription() : string
|
||||||
|
{
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
|
||||||
|
public function up(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this up() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
||||||
|
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update timestamp default current_timestamp on update current_timestamp');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(Schema $schema) : void
|
||||||
|
{
|
||||||
|
// this down() migration is auto-generated, please modify it to your needs
|
||||||
|
$this->abortIf($this->connection->getDatabasePlatform()->getName() !== 'mysql', 'Migration can only be executed safely on \'mysql\'.');
|
||||||
|
|
||||||
|
$this->addSql('ALTER TABLE battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
||||||
|
$this->addSql('ALTER TABLE sap_battery CHANGE date_update date_update DATETIME DEFAULT CURRENT_TIMESTAMP');
|
||||||
|
}
|
||||||
|
}
|
||||||
50
src/Repository/NotifsRepository.php
Normal file
50
src/Repository/NotifsRepository.php
Normal file
|
|
@ -0,0 +1,50 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Repository;
|
||||||
|
|
||||||
|
use App\Entity\Notifs;
|
||||||
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @method Notifs|null find($id, $lockMode = null, $lockVersion = null)
|
||||||
|
* @method Notifs|null findOneBy(array $criteria, array $orderBy = null)
|
||||||
|
* @method Notifs[] findAll()
|
||||||
|
* @method Notifs[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
|
||||||
|
*/
|
||||||
|
class NotifsRepository extends ServiceEntityRepository
|
||||||
|
{
|
||||||
|
public function __construct(ManagerRegistry $registry)
|
||||||
|
{
|
||||||
|
parent::__construct($registry, Notifs::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
// /**
|
||||||
|
// * @return Notifs[] Returns an array of Notifs objects
|
||||||
|
// */
|
||||||
|
/*
|
||||||
|
public function findByExampleField($value)
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('n')
|
||||||
|
->andWhere('n.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->orderBy('n.id', 'ASC')
|
||||||
|
->setMaxResults(10)
|
||||||
|
->getQuery()
|
||||||
|
->getResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
public function findOneBySomeField($value): ?Notifs
|
||||||
|
{
|
||||||
|
return $this->createQueryBuilder('n')
|
||||||
|
->andWhere('n.exampleField = :val')
|
||||||
|
->setParameter('val', $value)
|
||||||
|
->getQuery()
|
||||||
|
->getOneOrNullResult()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
namespace App\Repository;
|
namespace App\Repository;
|
||||||
|
|
||||||
use App\Entity\Test;
|
use App\Entity\Entity;
|
||||||
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
use Doctrine\Bundle\DoctrineBundle\Repository\ServiceEntityRepository;
|
||||||
use Doctrine\Persistence\ManagerRegistry;
|
use Doctrine\Persistence\ManagerRegistry;
|
||||||
|
|
||||||
|
|
@ -16,7 +16,7 @@ class TestRepository extends ServiceEntityRepository
|
||||||
{
|
{
|
||||||
public function __construct(ManagerRegistry $registry)
|
public function __construct(ManagerRegistry $registry)
|
||||||
{
|
{
|
||||||
parent::__construct($registry, Test::class);
|
parent::__construct($registry, Entity::class);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
<div class="m-subheader">
|
<div class="m-subheader">
|
||||||
<div class="d-flex align-items-center">
|
<div class="d-flex align-items-center">
|
||||||
<div class="mr-auto">
|
<div class="mr-auto">
|
||||||
<h3 class="m-subheader__title">Test Types</h3>
|
<h3 class="m-subheader__title">Product list</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -23,16 +23,16 @@
|
||||||
</span>
|
</span>
|
||||||
<h3 class="m-portlet__head-text">
|
<h3 class="m-portlet__head-text">
|
||||||
{% if mode == 'update' %}
|
{% if mode == 'update' %}
|
||||||
Edit Test Type
|
Edit Product Type
|
||||||
<small>{{ obj.getItem() }}</small>
|
<small>{{ obj.getItem() }}</small>
|
||||||
{% else %}
|
{% else %}
|
||||||
New Test Type
|
New Product Type
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('test_type_update_submit', {'id': obj.getId()}) : url('test_type_add_submit') }}">
|
<form id="row-form" class="m-form m-form--fit m-form--label-align-right m-form--group-seperator-dashed" method="post" action="{{ mode == 'update' ? url('entity_update_submit', {'id': obj.getId()}) : url('entity_add_submit') }}">
|
||||||
<div class="m-portlet__body">
|
<div class="m-portlet__body">
|
||||||
<div class="form-group m-form__group row no-border">
|
<div class="form-group m-form__group row no-border">
|
||||||
<label class="col-lg-3 col-form-label" data-field="item">
|
<label class="col-lg-3 col-form-label" data-field="item">
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<button type="submit" class="btn btn-success">Submit</button>
|
<button type="submit" class="btn btn-success">Submit</button>
|
||||||
<a href="{{ url('test_list') }}" class="btn btn-secondary">Back</a>
|
<a href="{{ url('entity_list') }}" class="btn btn-secondary">Back</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -99,7 +99,7 @@ $(function() {
|
||||||
text: 'Your changes have been saved!',
|
text: 'Your changes have been saved!',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
onClose: function() {
|
onClose: function() {
|
||||||
window.location.href = "{{ url('test_list') }}";
|
window.location.href = "{{ url('entity_list') }}";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}).fail(function(response) {
|
}).fail(function(response) {
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 order-1 order-xl-2 m--align-right">
|
<div class="col-xl-4 order-1 order-xl-2 m--align-right">
|
||||||
<a href="{{ url('test_type_add_form') }}" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
|
<a href="{{ url('entity_add_form') }}" class="btn btn-focus m-btn m-btn--custom m-btn--icon m-btn--air m-btn--pill">
|
||||||
<span>
|
<span>
|
||||||
<i class="la la-industry"></i>
|
<i class="la la-industry"></i>
|
||||||
<span>New Item</span>
|
<span>New Item</span>
|
||||||
|
|
@ -61,7 +61,7 @@ $(function() {
|
||||||
type: 'remote',
|
type: 'remote',
|
||||||
source: {
|
source: {
|
||||||
read: {
|
read: {
|
||||||
url: '{{ url("test_type_rows") }}',
|
url: '{{ url("entity_rows") }}',
|
||||||
method: 'POST'
|
method: 'POST'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue