cake update

controllerでgetして、$this->Posts->save

public function edit($id = null)
	{
		$this->viewBuilder()->layout('my_layout');
		$post = $this->Posts->get($id);
		if($this->request->is(['post','patch','put'])){
			$post = $this->Posts->patchEntity($post, $this->request->data);
			if($this->Posts->save($post)){
				$this->Flash->success('Edit Success!');
				return $this->redirect(['action'=>'index']);
			}else {
				$this->Flash->success('Error');
			}
		}
		$this->set('post', $post);
	}

deleteは $this->Posts->deleteになる

public function edit($id = null)
	{
		$this->viewBuilder()->layout('my_layout');
		$this->request->allowMethod(['post', 'delete']);
		$post = $this->Posts->get($id);
		if($this->Posts->delete($post)){
			$this->Flash->success('Delete Success!');
			
		}else {
			$this->Flash->success('Error');
		}
		return $this->redirect(['action'=>'index']);

	}