function removeToMongodb($login_account, $path, $hashID, $filename) { $dm = $this->get('doctrine.odm.mongodb.document_manager'); $doc = new \WebIM\ImChatBundle\Document\WeDocument(); $doc->setName($filename); $doc->setFile($path); $dm->persist($doc); $dm->flush(); $fileid = $doc->getId(); unlink($path); try { $sql = "insert into im_lib_files(fileid,filepath,savelevel,lastdate)values(?,?,'2',now())"; $all_params = array((string) $hashID, (string) $fileid); $da = $this->get('we_data_access_im'); $da->ExecSQL($sql, $all_params); } catch (\Exception $e) { } return $fileid; }
public function removeToMongodb($id, $login_account, $circleid, $path, $filename) { $dm = $this->get('doctrine.odm.mongodb.document_manager'); $doc = new \WebIM\ImChatBundle\Document\WeDocument(); $doc->setName($filename); $doc->setFile($path); $dm->persist($doc); $dm->flush(); $fileid = $doc->getId(); unlink($path); $sql = "insert into we_files(`circle_id`,`file_ext`,`file_id`,`file_name`,`post_to_group`,`up_by_staff`,`up_date`,`dir`)values(?,?,?,?,?,?,now(),?)"; $all_params = array((string) $circleid, "html", (string) $fileid, (string) $filename, "-1", (string) $login_account, (string) $id); $da = $this->get('we_data_access'); $da->ExecSQL($sql, $all_params); return true; }