Commit db5b18f0 authored by Julie gauthier's avatar Julie gauthier

Merge branch '685-maj-3-4-request-response-deprecations' into 'develop'

Resolve "maj 3.4 Request & Response Deprecations"

Closes #685

See merge request !258
parents 3783dd3d 7dbdb715
Pipeline #5305 failed with stage
in 6 minutes and 59 seconds
<?php <?php
namespace App\Controller\Api\V1; namespace App\Controller\Api\V1;
use App\Controller\AppController; use App\Controller\AppController;
...@@ -28,7 +29,7 @@ class LicenceTypesController extends AppController ...@@ -28,7 +29,7 @@ class LicenceTypesController extends AppController
/** /**
* View method * View method
* *
* @param string|null $id Licence Type id. * @param string|null $id Licence Type id.
* @return void * @return void
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -37,7 +38,7 @@ class LicenceTypesController extends AppController ...@@ -37,7 +38,7 @@ class LicenceTypesController extends AppController
$licenceType = $this->LicenceTypes->get( $licenceType = $this->LicenceTypes->get(
$id, $id,
[ [
'contain' => [] 'contain' => []
] ]
); );
$this->set('licenceType', $licenceType); $this->set('licenceType', $licenceType);
...@@ -53,7 +54,7 @@ class LicenceTypesController extends AppController ...@@ -53,7 +54,7 @@ class LicenceTypesController extends AppController
{ {
$licenceType = $this->LicenceTypes->newEntity(); $licenceType = $this->LicenceTypes->newEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$licenceType = $this->LicenceTypes->patchEntity($licenceType, $this->request->data); $licenceType = $this->LicenceTypes->patchEntity($licenceType, $this->request->getData());
if ($this->LicenceTypes->save($licenceType)) { if ($this->LicenceTypes->save($licenceType)) {
$this->Flash->success(__('The licence type has been saved.')); $this->Flash->success(__('The licence type has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -62,14 +63,14 @@ class LicenceTypesController extends AppController ...@@ -62,14 +63,14 @@ class LicenceTypesController extends AppController
$errors = $licenceType->errors(); $errors = $licenceType->errors();
} }
} }
$this->set(compact(['licenceType','errors'])); $this->set(compact(['licenceType', 'errors']));
$this->set('_serialize', ['licenceType','errors']); $this->set('_serialize', ['licenceType', 'errors']);
} }
/** /**
* Edit method * Edit method
* *
* @param string|null $id Licence Type id. * @param string|null $id Licence Type id.
* @return void Redirects on successful edit, renders view otherwise. * @return void Redirects on successful edit, renders view otherwise.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -78,11 +79,11 @@ class LicenceTypesController extends AppController ...@@ -78,11 +79,11 @@ class LicenceTypesController extends AppController
$licenceType = $this->LicenceTypes->get( $licenceType = $this->LicenceTypes->get(
$id, $id,
[ [
'contain' => [] 'contain' => []
] ]
); );
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$licenceType = $this->LicenceTypes->patchEntity($licenceType, $this->request->data); $licenceType = $this->LicenceTypes->patchEntity($licenceType, $this->request->getData());
if ($this->LicenceTypes->save($licenceType)) { if ($this->LicenceTypes->save($licenceType)) {
$this->Flash->success(__('The licence type has been saved.')); $this->Flash->success(__('The licence type has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -97,7 +98,7 @@ class LicenceTypesController extends AppController ...@@ -97,7 +98,7 @@ class LicenceTypesController extends AppController
/** /**
* Delete method * Delete method
* *
* @param string|null $id Licence Type id. * @param string|null $id Licence Type id.
* @return Response|null Redirects to index. * @return Response|null Redirects to index.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
......
...@@ -32,7 +32,7 @@ class LicensesController extends AppController ...@@ -32,7 +32,7 @@ class LicensesController extends AppController
/** /**
* View method * View method
* *
* @param string|null $id License id. * @param string|null $id License id.
* @return void * @return void
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -57,7 +57,7 @@ class LicensesController extends AppController ...@@ -57,7 +57,7 @@ class LicensesController extends AppController
{ {
$license = $this->Licenses->newEntity(); $license = $this->Licenses->newEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$license = $this->Licenses->patchEntity($license, $this->request->data); $license = $this->Licenses->patchEntity($license, $this->request->getData());
if ($this->Licenses->save($license)) { if ($this->Licenses->save($license)) {
$this->Flash->success(__('The license has been saved.')); $this->Flash->success(__('The license has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -73,7 +73,7 @@ class LicensesController extends AppController ...@@ -73,7 +73,7 @@ class LicensesController extends AppController
/** /**
* Edit method * Edit method
* *
* @param string|null $id License id. * @param string|null $id License id.
* @return void Redirects on successful edit, renders view otherwise. * @return void Redirects on successful edit, renders view otherwise.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -86,7 +86,7 @@ class LicensesController extends AppController ...@@ -86,7 +86,7 @@ class LicensesController extends AppController
] ]
); );
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$license = $this->Licenses->patchEntity($license, $this->request->data); $license = $this->Licenses->patchEntity($license, $this->request->getData());
if ($this->Licenses->save($license)) { if ($this->Licenses->save($license)) {
$this->Flash->success(__('The license has been saved.')); $this->Flash->success(__('The license has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -102,7 +102,7 @@ class LicensesController extends AppController ...@@ -102,7 +102,7 @@ class LicensesController extends AppController
/** /**
* Delete method * Delete method
* *
* @param string|null $id License id. * @param string|null $id License id.
* @return Response|null Redirects to index. * @return Response|null Redirects to index.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
......
...@@ -99,8 +99,10 @@ class PagesController extends AppController ...@@ -99,8 +99,10 @@ class PagesController extends AppController
$Softwares = TableRegistry::get("Softwares"); $Softwares = TableRegistry::get("Softwares");
//TO SORT //TO SORT
if (isset($this->request->query["order"])) { if (!is_null($this->request->getQuery("order"))) {
$sort = explode(".", $this->request->query["order"]); $sort = explode(".", $this->request->getQuery("order"));
// Note JGauthier 2019-07-16: just discovered this horror. This is not the correct way to do this.
// TODO This should be fixed
$this->request->query["sort"] = $sort[0]; $this->request->query["sort"] = $sort[0];
$this->request->query["direction"] = $sort[1]; $this->request->query["direction"] = $sort[1];
} }
...@@ -122,20 +124,22 @@ class PagesController extends AppController ...@@ -122,20 +124,22 @@ class PagesController extends AppController
] ]
]; ];
if (isset($this->request->data["search"])) { if (null !== ($this->request->getData("search"))) {
$searchQuery = $this->request->data["search"]; $searchQuery = $this->request->getData("search");
} else { } else {
$searchQuery = $this->request->query["search"]; $searchQuery = $this->request->getData("search");
} }
$this->set('searchQuery', $searchQuery); $this->set('searchQuery', $searchQuery);
// keep spaces , uppercase and transiterate accent characters to non-accent characters. // keep spaces , uppercase and transiterate accent characters to non-accent characters.
// Note JGauthier 2019-07-16: just discovered this horror. This is not the correct way to do this.
// TODO This should be fixed
$this->request->query['search'] = strtoupper(Text::slug($searchQuery)); $this->request->query['search'] = strtoupper(Text::slug($searchQuery));
$softwares = $Softwares $softwares = $Softwares
->find( ->find(
'search', 'search',
[ [
'search' => $this->request->query, 'search' => $this->request->getQueryParams(),
"contain" => ["Reviews"], "contain" => ["Reviews"],
] ]
) )
...@@ -155,7 +159,7 @@ class PagesController extends AppController ...@@ -155,7 +159,7 @@ class PagesController extends AppController
->find( ->find(
'search', 'search',
[ [
'search' => $this->request->query, 'search' => $this->request->getQueryParams(),
'contain' => ['UserTypes'], 'contain' => ['UserTypes'],
'order' => [ 'order' => [
'Users.username' => Configure::read('ORDER') 'Users.username' => Configure::read('ORDER')
...@@ -199,11 +203,11 @@ class PagesController extends AppController ...@@ -199,11 +203,11 @@ class PagesController extends AppController
$this->set('hasServiceProvider', $hasServiceProvider); $this->set('hasServiceProvider', $hasServiceProvider);
$this->set('order', $order); $this->set('order', $order);
$this->set('screenCaptured', $screenCaptured); $this->set('screenCaptured', $screenCaptured);
// $this->set('sort',$this->request->data['sort']); // $this->set('sort',$this->request->getData('sort'));
// $this->set('direction',$this->request->data['direction']); // $this->set('direction',$this->request->getData('direction'));
//To populate SearchForm //To populate SearchForm
$this->request->data = $this->request->query; $this->request->getData($this->request->getQueryParams());
$this->set('softwares', $this->paginate($softwares)); $this->set('softwares', $this->paginate($softwares));
$this->set('users', $this->paginate($this->Users)); $this->set('users', $this->paginate($this->Users));
......
...@@ -35,7 +35,7 @@ class RawMetricsSoftwaresController extends AppController ...@@ -35,7 +35,7 @@ class RawMetricsSoftwaresController extends AppController
/** /**
* View method * View method
* *
* @param string|null $id Raw Metrics Software id. * @param string|null $id Raw Metrics Software id.
* @return Response|null * @return Response|null
* @throws RecordNotFoundException When record not found. * @throws RecordNotFoundException When record not found.
*/ */
...@@ -61,7 +61,10 @@ class RawMetricsSoftwaresController extends AppController ...@@ -61,7 +61,10 @@ class RawMetricsSoftwaresController extends AppController
{ {
$rawMetricsSoftware = $this->RawMetricsSoftwares->newEntity(); $rawMetricsSoftware = $this->RawMetricsSoftwares->newEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$rawMetricsSoftware = $this->RawMetricsSoftwares->patchEntity($rawMetricsSoftware, $this->request->data); $rawMetricsSoftware = $this->RawMetricsSoftwares->patchEntity(
$rawMetricsSoftware,
$this->request->getData()
);
if ($this->RawMetricsSoftwares->save($rawMetricsSoftware)) { if ($this->RawMetricsSoftwares->save($rawMetricsSoftware)) {
$this->Flash->success(__('The raw metrics software has been saved.')); $this->Flash->success(__('The raw metrics software has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -77,7 +80,7 @@ class RawMetricsSoftwaresController extends AppController ...@@ -77,7 +80,7 @@ class RawMetricsSoftwaresController extends AppController
/** /**
* Edit method * Edit method
* *
* @param string|null $id Raw Metrics Software id. * @param string|null $id Raw Metrics Software id.
* @return Response|void Redirects on successful edit, renders view otherwise. * @return Response|void Redirects on successful edit, renders view otherwise.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -90,7 +93,10 @@ class RawMetricsSoftwaresController extends AppController ...@@ -90,7 +93,10 @@ class RawMetricsSoftwaresController extends AppController
] ]
); );
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$rawMetricsSoftware = $this->RawMetricsSoftwares->patchEntity($rawMetricsSoftware, $this->request->data); $rawMetricsSoftware = $this->RawMetricsSoftwares->patchEntity(
$rawMetricsSoftware,
$this->request->getData()
);
if ($this->RawMetricsSoftwares->save($rawMetricsSoftware)) { if ($this->RawMetricsSoftwares->save($rawMetricsSoftware)) {
$this->Flash->success(__('The raw metrics software has been saved.')); $this->Flash->success(__('The raw metrics software has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -106,7 +112,7 @@ class RawMetricsSoftwaresController extends AppController ...@@ -106,7 +112,7 @@ class RawMetricsSoftwaresController extends AppController
/** /**
* Delete method * Delete method
* *
* @param string|null $id Raw Metrics Software id. * @param string|null $id Raw Metrics Software id.
* @return Response|null Redirects to index. * @return Response|null Redirects to index.
* @throws RecordNotFoundException When record not found. * @throws RecordNotFoundException When record not found.
*/ */
......
...@@ -29,7 +29,7 @@ class RelationshipTypesController extends AppController ...@@ -29,7 +29,7 @@ class RelationshipTypesController extends AppController
/** /**
* View method * View method
* *
* @param string|null $id Relationship Type id. * @param string|null $id Relationship Type id.
* @return void * @return void
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -54,7 +54,7 @@ class RelationshipTypesController extends AppController ...@@ -54,7 +54,7 @@ class RelationshipTypesController extends AppController
{ {
$relationshipType = $this->RelationshipTypes->newEntity(); $relationshipType = $this->RelationshipTypes->newEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$relationshipType = $this->RelationshipTypes->patchEntity($relationshipType, $this->request->data); $relationshipType = $this->RelationshipTypes->patchEntity($relationshipType, $this->request->getData());
if ($this->RelationshipTypes->save($relationshipType)) { if ($this->RelationshipTypes->save($relationshipType)) {
$this->Flash->success(__('The relationship type has been saved.')); $this->Flash->success(__('The relationship type has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -69,7 +69,7 @@ class RelationshipTypesController extends AppController ...@@ -69,7 +69,7 @@ class RelationshipTypesController extends AppController
/** /**
* Edit method * Edit method
* *
* @param string|null $id Relationship Type id. * @param string|null $id Relationship Type id.
* @return void Redirects on successful edit, renders view otherwise. * @return void Redirects on successful edit, renders view otherwise.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -82,7 +82,7 @@ class RelationshipTypesController extends AppController ...@@ -82,7 +82,7 @@ class RelationshipTypesController extends AppController
] ]
); );
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$relationshipType = $this->RelationshipTypes->patchEntity($relationshipType, $this->request->data); $relationshipType = $this->RelationshipTypes->patchEntity($relationshipType, $this->request->getData());
if ($this->RelationshipTypes->save($relationshipType)) { if ($this->RelationshipTypes->save($relationshipType)) {
$this->Flash->success(__('The relationship type has been saved.')); $this->Flash->success(__('The relationship type has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -97,7 +97,7 @@ class RelationshipTypesController extends AppController ...@@ -97,7 +97,7 @@ class RelationshipTypesController extends AppController
/** /**
* Delete method * Delete method
* *
* @param string|null $id Relationship Type id. * @param string|null $id Relationship Type id.
* @return Response|null Redirects to index. * @return Response|null Redirects to index.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
......
...@@ -34,7 +34,7 @@ class RelationshipsController extends AppController ...@@ -34,7 +34,7 @@ class RelationshipsController extends AppController
/** /**
* View method * View method
* *
* @param string|null $id Relationship id. * @param string|null $id Relationship id.
* @return void * @return void
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -59,7 +59,7 @@ class RelationshipsController extends AppController ...@@ -59,7 +59,7 @@ class RelationshipsController extends AppController
{ {
$relationship = $this->Relationships->newEntity(); $relationship = $this->Relationships->newEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$relationship = $this->Relationships->patchEntity($relationship, $this->request->data); $relationship = $this->Relationships->patchEntity($relationship, $this->request->getData());
if ($this->Relationships->save($relationship)) { if ($this->Relationships->save($relationship)) {
$this->Flash->success(__('The relationship has been saved.')); $this->Flash->success(__('The relationship has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -77,7 +77,7 @@ class RelationshipsController extends AppController ...@@ -77,7 +77,7 @@ class RelationshipsController extends AppController
/** /**
* Edit method * Edit method
* *
* @param string|null $id Relationship id. * @param string|null $id Relationship id.
* @return void Redirects on successful edit, renders view otherwise. * @return void Redirects on successful edit, renders view otherwise.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -90,7 +90,7 @@ class RelationshipsController extends AppController ...@@ -90,7 +90,7 @@ class RelationshipsController extends AppController
] ]
); );
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$relationship = $this->Relationships->patchEntity($relationship, $this->request->data); $relationship = $this->Relationships->patchEntity($relationship, $this->request->getData());
if ($this->Relationships->save($relationship)) { if ($this->Relationships->save($relationship)) {
$this->Flash->success(__('The relationship has been saved.')); $this->Flash->success(__('The relationship has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -108,7 +108,7 @@ class RelationshipsController extends AppController ...@@ -108,7 +108,7 @@ class RelationshipsController extends AppController
/** /**
* Delete method * Delete method
* *
* @param string|null $id Relationship id. * @param string|null $id Relationship id.
* @return Response|null Redirects to index. * @return Response|null Redirects to index.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
......
...@@ -69,7 +69,7 @@ class RelationshipsSoftwaresController extends AppController ...@@ -69,7 +69,7 @@ class RelationshipsSoftwaresController extends AppController
if ($this->request->is('post')) { if ($this->request->is('post')) {
$relationshipsSoftware = $this->RelationshipsSoftwares->patchEntity( $relationshipsSoftware = $this->RelationshipsSoftwares->patchEntity(
$relationshipsSoftware, $relationshipsSoftware,
$this->request->data $this->request->getData()
); );
if ($this->RelationshipsSoftwares->save($relationshipsSoftware)) { if ($this->RelationshipsSoftwares->save($relationshipsSoftware)) {
$this->Flash->success(__('The relationships software has been saved.')); $this->Flash->success(__('The relationships software has been saved.'));
...@@ -102,7 +102,7 @@ class RelationshipsSoftwaresController extends AppController ...@@ -102,7 +102,7 @@ class RelationshipsSoftwaresController extends AppController
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$relationshipsSoftware = $this->RelationshipsSoftwares->patchEntity( $relationshipsSoftware = $this->RelationshipsSoftwares->patchEntity(
$relationshipsSoftware, $relationshipsSoftware,
$this->request->data $this->request->getData()
); );
if ($this->RelationshipsSoftwares->save($relationshipsSoftware)) { if ($this->RelationshipsSoftwares->save($relationshipsSoftware)) {
$this->Flash->success(__('The relationships software has been saved.')); $this->Flash->success(__('The relationships software has been saved.'));
......
...@@ -40,7 +40,7 @@ class RelationshipsSoftwaresUsersController extends AppController ...@@ -40,7 +40,7 @@ class RelationshipsSoftwaresUsersController extends AppController
'all', 'all',
[ [
'contain' => ["Users", "Relationships"], 'contain' => ["Users", "Relationships"],
'conditions' => ["Relationships.cd = " => $this->request->query['Relationships']], 'conditions' => ["Relationships.cd = " => $this->request->getQuery('Relationships')],
] ]
) )
->distinct("user_id"); ->distinct("user_id");
...@@ -90,7 +90,7 @@ class RelationshipsSoftwaresUsersController extends AppController ...@@ -90,7 +90,7 @@ class RelationshipsSoftwaresUsersController extends AppController
if ($this->request->is('post') && !$this->request->is('json')) { if ($this->request->is('post') && !$this->request->is('json')) {
$relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity( $relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity(
$relationshipsSoftwaresUser, $relationshipsSoftwaresUser,
$this->request->data $this->request->getData()
); );
if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) { if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) {
$this->Flash->success(__('The relationships softwares user has been saved.')); $this->Flash->success(__('The relationships softwares user has been saved.'));
...@@ -106,7 +106,7 @@ class RelationshipsSoftwaresUsersController extends AppController ...@@ -106,7 +106,7 @@ class RelationshipsSoftwaresUsersController extends AppController
} elseif ($this->request->is('post') && $this->request->is('json')) { } elseif ($this->request->is('post') && $this->request->is('json')) {
$relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity( $relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity(
$relationshipsSoftwaresUser, $relationshipsSoftwaresUser,
$this->request->data $this->request->getData()
); );
if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) { if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) {
$message = "Success"; $message = "Success";
...@@ -153,7 +153,7 @@ class RelationshipsSoftwaresUsersController extends AppController ...@@ -153,7 +153,7 @@ class RelationshipsSoftwaresUsersController extends AppController
if ($this->request->is(['patch', 'post', 'put']) && !$this->request->is('json')) { if ($this->request->is(['patch', 'post', 'put']) && !$this->request->is('json')) {
$relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity( $relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity(
$relationshipsSoftwaresUser, $relationshipsSoftwaresUser,
$this->request->data $this->request->getData()
); );
if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) { if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) {
$this->Flash->success(__('The relationships softwares user has been saved.')); $this->Flash->success(__('The relationships softwares user has been saved.'));
...@@ -170,7 +170,7 @@ class RelationshipsSoftwaresUsersController extends AppController ...@@ -170,7 +170,7 @@ class RelationshipsSoftwaresUsersController extends AppController
} elseif ($this->request->is(['patch', 'post', 'put']) && $this->request->is('json')) { } elseif ($this->request->is(['patch', 'post', 'put']) && $this->request->is('json')) {
$relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity( $relationshipsSoftwaresUser = $this->RelationshipsSoftwaresUsers->patchEntity(
$relationshipsSoftwaresUser, $relationshipsSoftwaresUser,
$this->request->data $this->request->getData()
); );
if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) { if ($this->RelationshipsSoftwaresUsers->save($relationshipsSoftwaresUser)) {
$message = "Success"; $message = "Success";
......
...@@ -32,7 +32,7 @@ class RelationshipsUsersController extends AppController ...@@ -32,7 +32,7 @@ class RelationshipsUsersController extends AppController
/** /**
* View method * View method
* *
* @param string|null $id Relationships User id. * @param string|null $id Relationships User id.
* @return void * @return void
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -57,7 +57,7 @@ class RelationshipsUsersController extends AppController ...@@ -57,7 +57,7 @@ class RelationshipsUsersController extends AppController
{ {
$relationshipsUser = $this->RelationshipsUsers->newEntity(); $relationshipsUser = $this->RelationshipsUsers->newEntity();
if ($this->request->is('post')) { if ($this->request->is('post')) {
$relationshipsUser = $this->RelationshipsUsers->patchEntity($relationshipsUser, $this->request->data); $relationshipsUser = $this->RelationshipsUsers->patchEntity($relationshipsUser, $this->request->getData());
if ($this->RelationshipsUsers->save($relationshipsUser)) { if ($this->RelationshipsUsers->save($relationshipsUser)) {
$this->Flash->success(__('The relationships user has been saved.')); $this->Flash->success(__('The relationships user has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -74,7 +74,7 @@ class RelationshipsUsersController extends AppController ...@@ -74,7 +74,7 @@ class RelationshipsUsersController extends AppController
/** /**
* Edit method * Edit method
* *
* @param string|null $id Relationships User id. * @param string|null $id Relationships User id.
* @return void Redirects on successful edit, renders view otherwise. * @return void Redirects on successful edit, renders view otherwise.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
...@@ -87,7 +87,7 @@ class RelationshipsUsersController extends AppController ...@@ -87,7 +87,7 @@ class RelationshipsUsersController extends AppController
] ]
); );
if ($this->request->is(['patch', 'post', 'put'])) { if ($this->request->is(['patch', 'post', 'put'])) {
$relationshipsUser = $this->RelationshipsUsers->patchEntity($relationshipsUser, $this->request->data); $relationshipsUser = $this->RelationshipsUsers->patchEntity($relationshipsUser, $this->request->getData());
if ($this->RelationshipsUsers->save($relationshipsUser)) { if ($this->RelationshipsUsers->save($relationshipsUser)) {
$this->Flash->success(__('The relationships user has been saved.')); $this->Flash->success(__('The relationships user has been saved.'));
return $this->redirect(['action' => 'index']); return $this->redirect(['action' => 'index']);
...@@ -104,7 +104,7 @@ class RelationshipsUsersController extends AppController ...@@ -104,7 +104,7 @@ class RelationshipsUsersController extends AppController
/** /**
* Delete method * Delete method
* *
* @param string|null $id Relationships User id. * @param string|null $id Relationships User id.
* @return Response|null Redirects to index. * @return Response|null Redirects to index.
* @throws NotFoundException When record not found. * @throws NotFoundException When record not found.
*/ */
......
...@@ -44,19 +44,19 @@ class ReviewsController extends AppController ...@@ -44,19 +44,19 @@ class ReviewsController extends AppController
public function index() public function index()
{ {
if (isset($this->request->params['software_id'])) { if (!is_null($this->request->getParam('software_id'))) {
$this->viewBuilder()->setTemplate("reviews_software"); $this->viewBuilder()->setTemplate("reviews_software");
$software = $this->Reviews->Softwares->find("all")->select([ $software = $this->Reviews->Softwares->find("all")->select([
"id", "id",
"softwarename" "softwarename"
])->where(["id" => $this->request->params['software_id']])->firstOrFail(); ])->where(["id" => $this->request->getParam('software_id')])->firstOrFail();
$this->set('software', $software); $this->set('software', $software);
$this->set('_serialize', ['software']); $this->set('_serialize', ['software']);
} }
$this->paginate = [ $this->paginate = [
'conditions' => isset($this->request->params['software_id']) ? [ 'conditions' => !is_null($this->request->getParam('software_id')) ? [
'Softwares.id ' => $this->request->params['software_id'] 'Softwares.id ' => $this->request->getParam('software_id')
] : [], ] : [],
'contain' => [ 'contain' => [
'Users' => ["fields" => ["id", "username", 'logo_directory', 'photo',]], 'Users' => ["fields" => ["id", "username", 'logo_directory', 'photo',]],
...@@ -123,34 +123,34 @@ class ReviewsController extends AppController ...@@ -123,34 +123,34 @@ class ReviewsController extends AppController
$message = ""; $message = "";
if ($this->request->is('post')) { if ($this->request->is('post')) {
try { try {
$software = $this->Reviews->Softwares->get($this->request->params['software_id']); $software = $this->Reviews->Softwares->get($this->request->getParam('software_id'));
$this->request->data['software_id'] = $software->id; $this->request->getData($software->id);
} catch (Exception $e) { } catch (Exception $e) {
throw new SoftwareNotFoundException( throw new SoftwareNotFoundException(
"The software with the id " . $this->request->params['software_id'] . " does not exist" "The software with the id " . $this->request->getParam('software_id') . " does not exist"
); );