CakePHPでユーザーが新規登録フォームに情報を入力後に本登録メールを送りたいのですが、メールを送るための関数（activate)がうまく機能しません。  
また、この関数をコメントアウトするとユーザーの情報がうまくDBに登録されるのですが、コメントアウトを外すと  
「Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Array' in
'field list'」と言うエラーが出てしまいます。  
activate関数に関して修正していただけると幸いです。

```

    <?php
     App::uses('AppController','Controller');
     App::uses('CakeEmail','Network/Email');
    
    
        class UsersController extends AppController {
            public $scaffold;
            public $helpers = array('Html','Form','Flash');
            public $name = 'User';  
            public $users = array('User','profile');    
            public $presetVars = true;
            public $components = array('Search.Prg');
    
            //public $components = array('Auth');
            //public function beforeFilter()
            //{
            //$this->Auth->allow('signup');
            //}
    
            public function signup()
            {
                if($this->request->is('post'))
            {
                // die(pr($this->request->data));
                if(is_uploaded_file($this->request->data['User']['profile_Image']['tmp_name']))
                {
                    $fileNameFull = $this->request->data['User']['username'] . "_" . $this->request->data['User']['profile_Image']['name'];
                    $oldFile = '../../app/webroot/img/'.$fileNameFull; 
    
                    move_uploaded_file(
                        $this->request->data['User']['profile_Image']['tmp_name'],
                        $oldFile
                    );
                    $this->User->create();
                    $this->request->data['User']['profile_Image'] = $fileNameFull;
                    if ($this->User->save($this->request->data)) {
                        $this->Session->setFlash('Registration suceessful');
                    }else{
                        $this->Session->setFlash('Error');
                    }
                }
    
    
    
                if($this->User->save($this->data))
            {
                        $url='activate/'.$this->User->id.'/'.$this->AppModel->getActiviationHash();
                        $url=Router::url($url,true);
    
                          $email=new CakeEmail();
                          $email->from(array('KD******@gmail.com' =>'Sender'));
                          $email->to($this->data['User']['email']);
                          $email->subject('Registration mail');
                          $email->send($url);
    
                    $this->Session->setFlash('Registration suceessful');
                   }else{
                    $this->Session->setFlash('Error');
                }
              }
             }
    
            public function activate($user_id=null,$in_hash=null)
            {
                $this->User->id=$user_id;
                if($this->User->exists() && $in_hash==$this->User->getActiviationHash()){
                   $this->User->saveFiled('active',1);
                $this->Session->setFlash('Your registration is seccessed');
            }else{
                $this->Session->setFlash('Invalid link');
            }
            }
    
            public function login()
            {
                if ($this->request->is('post'))
                {
                    if ($this->Auth->login()) {
                        return $this->redirect($this->Auth->redirectUrl());
                }
                    $this->Flash->error(__('Invalid username or password, try again'));
                }
    
            }
    
    
            public function logout()
            {     
            return $this->redirect($this->Auth->logout());
            }
    
            public function search()
            {
            $this->post->recursive = 0;
            $this->Prg->commonProcess();
            $this->paginate = array('conditions' => $this->Post->parseCriteria($this->passedArgs),);
            //pr($this->paginate());//debug
            $this->set('posts', $this->paginate());
             }
    
    
            public function find()  
            {
            // $user=$this->_connect_model->get('User')->getUserRecord($user['username']);      
            // $statuses=$this->_connect_model->get('Status')->getPostMessage($user['id']);///////postとる
    
             $followState=null;//////////////////////サインイン中のユーザーじゃない
             if($this->_session->isAuthenticated()){
                 $loginUser=$this->_session->get('user_id');
             //}/////////$loginUser=サインインしているユーザー　
              ////////$user=フォローするユーザーのID
             if($this->session->isAuthenticated($following_id)){
                 if($loginUser['id']!==$user['id']){
                        $state=$this->Follow->get('following_id')////////
                        ->isFollowedUser($my['id'],$user['id']);/////////フォロー済みか確認
                   }
                }
                  $user_view = $this->render(array(
                      'user'=>$user,
                      'statuses'=>$statuses,
                      'followstate'=>$followstate,
                      '_token'=>$this->getToken(self::FOLLOW),
                ));
    
                return $user_view;
                $this->set('statuses',$statuses);
    
             $userNameKeyword=$this->request->data['Users']['username'];
             $users=$this->User->find('all', [
                     'conditions' => [
                     'User.username LIKE' => '%'.$userNameKeyword.'%'
                ],
            ]);
            $this->set('users',$users);
            $this->render();
         }
    
```
CC BY-SA 4.0
2019-06-15T17:32:22.547
55824
2019-06-19T01:31:07.310
2019-06-19T01:31:07.310
34463
34463
question
cakephp
CakePHPでユーザー新規登録時にメールを送りたいです。