コード例 #1
0
ファイル: File.php プロジェクト: Cevantime/site-core-modules
 protected function beforeInsert(&$to_insert = null)
 {
     if (array_key_exists('parent_id', $to_insert) && !$to_insert['parent_id']) {
         $to_insert['parent_id'] = null;
     }
     if (array_key_exists('parent_id', $to_insert)) {
         $parent = $this->getId($to_insert['parent_id']);
     } else {
         $parent = null;
     }
     $to_insert['hierarchy'] = $parent ? $parent->hierarchy . '/' . $parent->id : '';
     if (!isset($to_insert['is_folder']) || !$to_insert['is_folder']) {
         $to_insert['infos'] = $this->infos['file'];
         $to_insert['name'] = $this->infos['file']['file_name'];
         $to_insert['type'] = $this->infos['file']['file_type'];
     } else {
         $to_insert['file'] = null;
         $to_insert['infos'] = null;
     }
     parent::beforeInsert($to_insert);
 }
コード例 #2
0
ファイル: User.php プロジェクト: Cevantime/site-core-modules
 protected function beforeInsert(&$to_insert = null)
 {
     parent::beforeInsert($to_insert);
     $to_insert['password'] = password_hash($to_insert['password'], PASSWORD_DEFAULT);
 }