$user = $this->Users->newEntity();
if ($this->request->is(‘post’)){
$number = $this->request->data[‘number’];
$num = $this->Users->findByEmail($number)->select([‘number’])->hydrate(false)->first();
if(!$this->Users->exists($num)){
$user = $this->Users->patchEntity($user, $this->request->data);
$this->Users->save($user);
echo "1";
}
else{
echo "There is another...";
}
}
$this->set(compact('user'));
$this->set('_serialize', ['user']);
}