CakePHP 3.0 将数据保存到表中

CakePHP 3.0 Save data in to tables

我正在尝试为用户创建一个日志系统 add 并在添加新用户时通知管理员,询问他允许新用户登录的权限。

有人知道是否有可用的插件吗?或者如何将这些数据保存在两个表中。

我试过了

public function add() {
  $user = $this->Users->newEntity();
  $log = $this->Logs->newEntity();
  if ($this->request->is('post')) {
    $user = $this->Users->patchEntity($user, $this->request->data);
    $user->criado_por = $this->Auth->user('nome');
    $user->modificado_por = $this->Auth->user('nome');
    $user->userstatus = 'waiting for permitions';

    $log->date = date::now();
    $log->newuser = $user->name;
    $log->whocreate = $this->Auth->User('name');

    if ($this->Users->save($user)) {
      $this->Flash->success(__('The user has been saved.'));
      return $this->redirect(['action' => 'index']);
    } else {
      $this->Flash->error(__('The user could not be saved. Please, try again.'));
    }
  }
  $this->set(compact('user'));
  $this->set('_serialize', ['user']);
}

这是 CakePHP 的通知插件:Notifier