So I'm tryng to create an edit functionality and it seems that when I press the edit button it redirects me to the edit page with the correct id but all the inputs are empty....any ideas why?
public function edit($id=null) {
$user =$this->Users->get($id);
if ( !$this->Users->exists($user) ) {
throw new NotFoundException( __( 'Invalid user' ) );
}
if ( $this->request->is( 'post' ) || $this->request->is( 'put' ) ) {
$user = $this->Users->patchEntity($user, $this->request->data);
$query = $this->Users->find( 'all', array( 'conditions' => array( 'id' => $id) ));
$aros = $query->first()->toArray();
$save = $this->Users->save( $this->request->data );
if ($save) {
$this->Flash->success( 'The user has been saved');
} else {
$this->Flash->error( 'The user could not be saved. Please, try again.');
}}
You didn't paste all required code so here two guesses:
I recommend you to do the basics tutorials on book.cakephp.org, it doesn't look like you have any idea how it works at all based on the pasted code and what you want to do.