tests wip
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace CakeProducts\Controller;
|
||||
|
||||
use Cake\Datasource\Exception\RecordNotFoundException;
|
||||
use Cake\Http\Response;
|
||||
use Cake\Log\Log;
|
||||
use CakeProducts\Controller\AppController;
|
||||
|
||||
/**
|
||||
* ExternalProductCatalogsProductCatalogs Controller
|
||||
*
|
||||
*/
|
||||
class ExternalProductCatalogsProductCatalogsController extends AppController
|
||||
{
|
||||
/**
|
||||
* Add method
|
||||
*
|
||||
* @return Response|null|void Redirects on successful add, renders view otherwise.
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
Log::debug('inside external product catalogs product catalogs controller add');
|
||||
$productCatalogs = $this->ExternalProductCatalogsProductCatalogs->ProductCatalogs->find('list')->toArray();
|
||||
$this->set(compact( 'productCatalogs'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete method
|
||||
*
|
||||
* @param string|null $id Customers Contact id.
|
||||
* @return Response|null Redirects to index.
|
||||
* @throws RecordNotFoundException When record not found.
|
||||
*/
|
||||
public function delete($id = null)
|
||||
{
|
||||
$this->request->allowMethod(['post', 'delete']);
|
||||
$externalProductCatalogProductCatalog = $this->ExternalProductCatalogsProductCatalogs->get($id);
|
||||
if ($this->ExternalProductCatalogsProductCatalogs->delete($externalProductCatalogProductCatalog)) {
|
||||
$this->Flash->success(__('The customers contact has been deleted.'));
|
||||
} else {
|
||||
$this->Flash->error(__('The customers contact could not be deleted. Please, try again.'));
|
||||
}
|
||||
|
||||
return $this->redirect($this->referer([
|
||||
'controller' => 'ExternalProductCatalogs',
|
||||
'action' => 'view',
|
||||
$externalProductCatalogProductCatalog->external_product_catalog_id,
|
||||
]));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user