1

As we are starting the second part of my project. And we would like to first start completing the migration process before working on the second half of the project. I’ve a few concern about the migration process and would like to clear my doubts.

Currently, in my project we’ve used a lot of these function mentioned below

  1. Do we have to replace all the $this->Form->input['description'] to $this->Form->control['description']?
  2. When you mentioned Response::download() would become Response::withDownload(). Do you mean that I have to change $this->response->download($filename) to $this->response->WithDownload($filename)?
  3. We've this code line $this->primaryKey('id') in our Table.php and you mentioned that is part of the deprecated list and replaced with getX() and setX() methods. What you mean by that? I hope you can give me an example.
  4. The below code is found in the controller and I noticed that you mention hydrate() (now enableHydration() / isHydrationEnabled()). What is the changes we need to make below?

    $CustomersordersTable-> find()                  
                              -> select(['order_id'=>'Customerorders.order_id'])
                              -> where(['id IN' => $studentlist])
                              -> hydrate(false)
                              -> toArray();
    
  5. I also understand that $this->request->data['id'] is deprecated and we need to $this->request->getData('id'). However, when adding details, right now we can't assign a random id value to this $this->request->getData('id'). I used to assign a random id with the below before saving into the table.

    $this->request->data['id'] = TableRegistry::get('Customers')->find('guid'); 
    

Do you have a tentative release date for CakePHP 4.0?

EssEss
  • 73
  • 10

2 Answers2

2
  1. Yes
  2. Yes
  3. Simply that you use set methods to set a value and get to get a value. Like setTable($name).
  4. enableHydration()
  5. The request data was never supposed to be modified directly. Not before 3.4 and not after. Get the data from the request, modify it, do whatever you wan't with it. Request objects in 3.4 are immutable.

There is no release date for CakePHP4, just a roadmap without any dates. CakePHP is developed by volunteers, so work gets done as people have time and mood to work on it. Contributions are welcome. :)

floriank
  • 25,546
  • 9
  • 42
  • 66
0

5.

$guid = TableRegistry::get('Customers')->find('guid');
$newData = $this->request->withData('id', $guid);

// get new request data

$newData->getData('id');
Tom
  • 1
  • 2
  • Welcome to Stack Overflow! While you may have solved this user's problem, code-only answers are not very helpful to users who come to this question in the future. Please edit your answer to explain why your code solves the original problem. – Joe C Feb 25 '17 at 12:37