/** * @author Okan CIRAN * @ info_firm_keys tablosuna yeni bir kayıt oluşturur. !! * @version v 1.0 17/03/2016 * @return array * @throws \PDOException */ public function insert($params = array()) { try { $pdo = $this->slimApp->getServiceManager()->get('pgConnectFactory'); // $pdo->beginTransaction(); $CountryCode = NULL; $CountryCodeValue = 'TR'; if (isset($params['country_id']) && $params['country_id'] != "") { $CountryCode = SysCountrys::getCountryCode(array('country_id' => $params['country_id'])); if (\Utill\Dal\Helper::haveRecord($CountryCode)) { $CountryCodeValue = $CountryCode['resultSet'][0]['country_code']; } } $sql = "\n INSERT INTO info_firm_keys( \n firm_id,\n network_key,\n machines_folder, \n logos_folder, \n products_folder, \n members_folder, \n others_folder,\n folder_name\n )\n VALUES (\n :firm_id, \n CONCAT('" . $CountryCodeValue . "',ostim_id_generator()),\n 'Machines',\n 'Logos',\n 'Products',\n 'Members',\n 'Others',\n 'x'\n ) "; $statement = $pdo->prepare($sql); $statement->bindValue(':firm_id', $params['firm_id'], \PDO::PARAM_STR); // echo debugPDO($sql, $params); $result = $statement->execute(); $insertID = $pdo->lastInsertId('info_firm_keys_id_seq'); $errorInfo = $statement->errorInfo(); InfoFirmKeys::setFirmPrivateKey(array('id' => $insertID)); if ($errorInfo[0] != "00000" && $errorInfo[1] != NULL && $errorInfo[2] != NULL) { throw new \PDOException($errorInfo[0]); } // $pdo->commit(); return array("found" => true, "errorInfo" => $errorInfo, "lastInsertId" => $insertID); } catch (\PDOException $e) { // $pdo->rollback(); return array("found" => false, "errorInfo" => $e->getMessage()); } }