Commit 834d7e77 authored by Fabrice Gangler's avatar Fabrice Gangler 🎨
Browse files

FEAT(mapping): add auto-generated controller files

Refs: #788
parent 94e9e595
<?php
namespace App\Controller\Api\V1;
use App\Controller\AppController;
use App\Model\Table\RelationshipsTaxonomysSofwaresTable;
/**
* RelationshipsTaxonomysSofwares Controller
*
* @property RelationshipsTaxonomysSofwaresTable $RelationshipsTaxonomysSofwares
*/
class RelationshipsTaxonomysSofwaresController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$this->paginate = [
'contain' => ['Taxonomys', 'Softwares', 'Users']
];
$relationshipsTaxonomysSofwares = $this->paginate($this->RelationshipsTaxonomysSofwares);
$this->set(compact('relationshipsTaxonomysSofwares'));
$this->set('_serialize', ['relationshipsTaxonomysSofwares']);
}
/**
* View method
*
* @param string|null $id Relationships Taxonomys Sofware id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$relationshipsTaxonomysSofware = $this->RelationshipsTaxonomysSofwares->get($id, [
'contain' => ['Taxonomys', 'Softwares', 'Users']
]);
$this->set('relationshipsTaxonomysSofware', $relationshipsTaxonomysSofware);
$this->set('_serialize', ['relationshipsTaxonomysSofware']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$relationshipsTaxonomysSofware = $this->RelationshipsTaxonomysSofwares->newEntity();
if ($this->request->is('post')) {
$relationshipsTaxonomysSofware = $this->RelationshipsTaxonomysSofwares->patchEntity($relationshipsTaxonomysSofware, $this->request->data);
if ($this->RelationshipsTaxonomysSofwares->save($relationshipsTaxonomysSofware)) {
$this->Flash->success(__('The relationships taxonomys sofware has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The relationships taxonomys sofware could not be saved. Please, try again.'));
}
$taxonomys = $this->RelationshipsTaxonomysSofwares->Taxonomys->find('list', ['limit' => 200]);
$softwares = $this->RelationshipsTaxonomysSofwares->Softwares->find('list', ['limit' => 200]);
$users = $this->RelationshipsTaxonomysSofwares->Users->find('list', ['limit' => 200]);
$this->set(compact('relationshipsTaxonomysSofware', 'taxonomys', 'softwares', 'users'));
$this->set('_serialize', ['relationshipsTaxonomysSofware']);
}
/**
* Edit method
*
* @param string|null $id Relationships Taxonomys Sofware id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$relationshipsTaxonomysSofware = $this->RelationshipsTaxonomysSofwares->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$relationshipsTaxonomysSofware = $this->RelationshipsTaxonomysSofwares->patchEntity($relationshipsTaxonomysSofware, $this->request->data);
if ($this->RelationshipsTaxonomysSofwares->save($relationshipsTaxonomysSofware)) {
$this->Flash->success(__('The relationships taxonomys sofware has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The relationships taxonomys sofware could not be saved. Please, try again.'));
}
$taxonomys = $this->RelationshipsTaxonomysSofwares->Taxonomys->find('list', ['limit' => 200]);
$softwares = $this->RelationshipsTaxonomysSofwares->Softwares->find('list', ['limit' => 200]);
$users = $this->RelationshipsTaxonomysSofwares->Users->find('list', ['limit' => 200]);
$this->set(compact('relationshipsTaxonomysSofware', 'taxonomys', 'softwares', 'users'));
$this->set('_serialize', ['relationshipsTaxonomysSofware']);
}
/**
* Delete method
*
* @param string|null $id Relationships Taxonomys Sofware id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$relationshipsTaxonomysSofware = $this->RelationshipsTaxonomysSofwares->get($id);
if ($this->RelationshipsTaxonomysSofwares->delete($relationshipsTaxonomysSofware)) {
$this->Flash->success(__('The relationships taxonomys sofware has been deleted.'));
} else {
$this->Flash->error(__('The relationships taxonomys sofware could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}
<?php
namespace App\Controller\Api\V1;
use App\Controller\AppController;
use App\Model\Table\TaxonomysTable;
/**
* Taxonomys Controller
*
* @property TaxonomysTable $Taxonomys
*/
class TaxonomysController extends AppController
{
/**
* Index method
*
* @return \Cake\Network\Response|null
*/
public function index()
{
$this->paginate = [
'contain' => ['ParentTaxonomys']
];
$taxonomys = $this->paginate($this->Taxonomys);
$this->set(compact('taxonomys'));
$this->set('_serialize', ['taxonomys']);
}
/**
* View method
*
* @param string|null $id Taxonomy id.
* @return \Cake\Network\Response|null
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function view($id = null)
{
$taxonomy = $this->Taxonomys->get($id, [
'contain' => ['ParentTaxonomys', 'RelationshipsTaxonomysSofwares', 'ChildTaxonomys']
]);
$this->set('taxonomy', $taxonomy);
$this->set('_serialize', ['taxonomy']);
}
/**
* Add method
*
* @return \Cake\Network\Response|null Redirects on successful add, renders view otherwise.
*/
public function add()
{
$taxonomy = $this->Taxonomys->newEntity();
if ($this->request->is('post')) {
$taxonomy = $this->Taxonomys->patchEntity($taxonomy, $this->request->data);
if ($this->Taxonomys->save($taxonomy)) {
$this->Flash->success(__('The taxonomy has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The taxonomy could not be saved. Please, try again.'));
}
$parentTaxonomys = $this->Taxonomys->ParentTaxonomys->find('list', ['limit' => 200]);
$this->set(compact('taxonomy', 'parentTaxonomys'));
$this->set('_serialize', ['taxonomy']);
}
/**
* Edit method
*
* @param string|null $id Taxonomy id.
* @return \Cake\Network\Response|null Redirects on successful edit, renders view otherwise.
* @throws \Cake\Network\Exception\NotFoundException When record not found.
*/
public function edit($id = null)
{
$taxonomy = $this->Taxonomys->get($id, [
'contain' => []
]);
if ($this->request->is(['patch', 'post', 'put'])) {
$taxonomy = $this->Taxonomys->patchEntity($taxonomy, $this->request->data);
if ($this->Taxonomys->save($taxonomy)) {
$this->Flash->success(__('The taxonomy has been saved.'));
return $this->redirect(['action' => 'index']);
}
$this->Flash->error(__('The taxonomy could not be saved. Please, try again.'));
}
$parentTaxonomys = $this->Taxonomys->ParentTaxonomys->find('list', ['limit' => 200]);
$this->set(compact('taxonomy', 'parentTaxonomys'));
$this->set('_serialize', ['taxonomy']);
}
/**
* Delete method
*
* @param string|null $id Taxonomy id.
* @return \Cake\Network\Response|null Redirects to index.
* @throws \Cake\Datasource\Exception\RecordNotFoundException When record not found.
*/
public function delete($id = null)
{
$this->request->allowMethod(['post', 'delete']);
$taxonomy = $this->Taxonomys->get($id);
if ($this->Taxonomys->delete($taxonomy)) {
$this->Flash->success(__('The taxonomy has been deleted.'));
} else {
$this->Flash->error(__('The taxonomy could not be deleted. Please, try again.'));
}
return $this->redirect(['action' => 'index']);
}
}
<?php
namespace App\Test\TestCase\Controller;
use App\Controller\RelationshipsTaxonomysSofwaresController;
use Cake\TestSuite\IntegrationTestCase;
/**
* App\Controller\RelationshipsTaxonomysSofwaresController Test Case
*/
class RelationshipsTaxonomysSofwaresControllerTest extends IntegrationTestCase
{
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.relationships_taxonomys_sofwares',
'app.taxonomys',
'app.softwares',
'app.licenses',
'app.licence_types',
'app.relationships_softwares_users',
'app.users',
'app.user_types',
'app.reviews',
'app.relationships',
'app.relationship_types',
'app.relationships_softwares',
'app.relationships_users',
'app.usedsoftwares',
'app.backedsoftwares',
'app.createdsoftwares',
'app.contributionssoftwares',
'app.providerforsoftwares',
'app.screenshots',
'app.softwares_statistics',
'app.tags',
'app.softwares_tags',
'app.userssoftwares',
'app.backerssoftwares',
'app.creatorssoftwares',
'app.contributorssoftwares',
'app.providerssoftwares',
'app.workswellsoftwares',
'app.alternativeto'
];
/**
* Test index method
*
* @return void
*/
public function testIndex()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test view method
*
* @return void
*/
public function testView()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test add method
*
* @return void
*/
public function testAdd()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test edit method
*
* @return void
*/
public function testEdit()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test delete method
*
* @return void
*/
public function testDelete()
{
$this->markTestIncomplete('Not implemented yet.');
}
}
<?php
namespace App\Test\TestCase\Controller;
use App\Controller\TaxonomysController;
use Cake\TestSuite\IntegrationTestCase;
/**
* App\Controller\TaxonomysController Test Case
*/
class TaxonomysControllerTest extends IntegrationTestCase
{
/**
* Fixtures
*
* @var array
*/
public $fixtures = [
'app.taxonomys',
'app.relationships_taxonomys_sofwares',
'app.softwares',
'app.licenses',
'app.licence_types',
'app.relationships_softwares_users',
'app.users',
'app.user_types',
'app.reviews',
'app.relationships',
'app.relationship_types',
'app.relationships_softwares',
'app.relationships_users',
'app.usedsoftwares',
'app.backedsoftwares',
'app.createdsoftwares',
'app.contributionssoftwares',
'app.providerforsoftwares',
'app.screenshots',
'app.softwares_statistics',
'app.tags',
'app.softwares_tags',
'app.userssoftwares',
'app.backerssoftwares',
'app.creatorssoftwares',
'app.contributorssoftwares',
'app.providerssoftwares',
'app.workswellsoftwares',
'app.alternativeto'
];
/**
* Test index method
*
* @return void
*/
public function testIndex()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test view method
*
* @return void
*/
public function testView()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test add method
*
* @return void
*/
public function testAdd()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test edit method
*
* @return void
*/
public function testEdit()
{
$this->markTestIncomplete('Not implemented yet.');
}
/**
* Test delete method
*
* @return void
*/
public function testDelete()
{
$this->markTestIncomplete('Not implemented yet.');
}
}
Supports Markdown
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