Logger
This commit is contained in:
parent
0be7f283b8
commit
11487e840b
@ -13,9 +13,19 @@ class Metier_Partenaires_MBourse
|
||||
*/
|
||||
protected $conn;
|
||||
|
||||
/**
|
||||
* Logger
|
||||
* @var \Monolog\Logger
|
||||
*/
|
||||
protected $logger;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->conn = Zend_Registry::get('doctrine');
|
||||
|
||||
if (Zend_Registry::isRegistered('logger')) {
|
||||
$this->logger = Zend_Registry::get('logger');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -110,11 +120,19 @@ class Metier_Partenaires_MBourse
|
||||
$siren = $this->siren;
|
||||
}
|
||||
|
||||
$sql = "SELECT isin FROM jo.infos_entrep WHERE siren=:siren AND isin!='' LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$sql = "SELECT isin FROM jo.infos_entrep WHERE siren=:siren AND isin!='' LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('siren', $siren);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return trim($result['isin']);
|
||||
}
|
||||
@ -129,11 +147,19 @@ class Metier_Partenaires_MBourse
|
||||
*/
|
||||
public function getCodeSiren($isin)
|
||||
{
|
||||
$sql = "SELECT siren FROM jo.infos_entrep WHERE isin=:isin AND siren!=0 LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$sql = "SELECT siren FROM jo.infos_entrep WHERE isin=:isin AND siren!=0 LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
return trim($result['siren']);
|
||||
}
|
||||
@ -165,11 +191,19 @@ class Metier_Partenaires_MBourse
|
||||
pressReleaseAttachments, pressReleaseUrl, source, dateInsert
|
||||
FROM presse.articles
|
||||
WHERE companyIsin=:isin $sqlID ORDER BY pressReleaseDate DESC";
|
||||
$bodaccStmt = $this->conn->prepare($bodaccSql);
|
||||
$bodaccStmt->bindValue('isin', $isin);
|
||||
$bodaccStmt->execute();
|
||||
|
||||
if ($bodaccStmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$bodaccStmt = $this->conn->prepare($bodaccSql);
|
||||
$bodaccStmt->bindValue('isin', $isin);
|
||||
$bodaccStmt->execute();
|
||||
$nb = $bodaccStmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
while($ann = $bodaccStmt->fetch(\PDO::FETCH_ASSOC)) {
|
||||
$format = array(
|
||||
'id' => $ann['id'],
|
||||
@ -219,10 +253,18 @@ class Metier_Partenaires_MBourse
|
||||
FROM sdv1.bourse_isin b, sdv1.bourse_cours c
|
||||
WHERE code_isin=:isin AND b.code_isin=c.isin AND c.autre IN('','e','f','g','m','s','u')
|
||||
ORDER BY c.`date` DESC, c.`heure` DESC LIMIT 0,1";
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
if ($stmt->rowCount() > 0) {
|
||||
$nb = 0;
|
||||
try {
|
||||
$stmt = $this->conn->prepare($sql);
|
||||
$stmt->bindValue('isin', $isin);
|
||||
$stmt->execute();
|
||||
$nb = $stmt->rowCount();
|
||||
} catch (\Doctrine\DBAL\DBALException $e) {
|
||||
if ($this->logger !== null) {
|
||||
$this->logger->error($e->getMessage());
|
||||
}
|
||||
}
|
||||
if ($nb > 0) {
|
||||
$result = $stmt->fetch(\PDO::FETCH_ASSOC);
|
||||
$courSql = "SELECT min(close) AS coursMin, avg(close) AS coursMoy,
|
||||
max(close) AS coursMax FROM sdv1.bourse_cours
|
||||
|
Loading…
Reference in New Issue
Block a user