Entreprise - getLiens : remove Application_Model

This commit is contained in:
Michael RICOIS 2017-03-15 14:59:59 +01:00
parent cbae95cf2b
commit 73f5b36ef4

View File

@ -895,23 +895,30 @@ class Entreprise extends Scores_Ws_Server
$nbIdNum = 3;
$refs = array();
$idM = new Application_Model_Sdv1TabIdLocal();
for ($i=0;$i<$nbIdNum;$i++) {
if( !empty($item->{'idLoc'.$i.'Num'}) ) {
$ref = new LienRefId();
$ref->num = $item->{'idLoc'.$i.'Num'};
if ( !empty($item->{'idLoc'.$i.'Type'}) ) {
$sql = $idM->select()->from($idM, array('idLocal', 'idPrincipal'))
->where('id=?', $item->{'idLoc'.$i.'Type'});
$result = $idM->fetchRow($sql);
if (null!==$result) {
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
if (!empty($item->{'idLoc'.$i.'Type'})) {
try {
$sql = "SELECT idLocal, idPrincipal FROM sdv1.tabIdLocal WHERE id=:id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $item->{'idLoc'.$i.'Type'});
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
} else {
$ref->label = 'Identifiant local';
$ref->type = 1;
@ -926,7 +933,7 @@ class Entreprise extends Scores_Ws_Server
}
}
//Participations
// Participations
$liens = $liensM->getParticipations(null, true);
if (count($liens)>0) {
foreach ( $liens as $item ) {
@ -961,22 +968,28 @@ class Entreprise extends Scores_Ws_Server
$nbIdNum = 3;
$refs = array();
$idM = new Application_Model_Sdv1TabIdLocal();
for ($i=0;$i<$nbIdNum;$i++) {
if( !empty($item->{'idLoc'.$i.'Num'}) ) {
$ref = new LienRefId();
$ref->num = $item->{'idLoc'.$i.'Num'};
if ( !empty($item->{'idLoc'.$i.'Type'}) ) {
$sql = $idM->select()->from($idM, array('idLocal', 'idPrincipal'))
->where('id=?', $item->{'idLoc'.$i.'Type'});
$result = $idM->fetchRow($sql);
if (null!==$result) {
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
if (!empty($item->{'idLoc'.$i.'Type'})) {
try {
$sql = "SELECT idLocal, idPrincipal FROM sdv1.tabIdLocal WHERE id=:id";
$stmt = $this->conn->prepare($sql);
$stmt->bindValue('id', $item->{'idLoc'.$i.'Type'});
$stmt->execute();
if ($stmt->rowCount() > 0) {
$result = $stmt->fetch(\PDO::FETCH_OBJ);
$ref->label = $result->idLocal;
$ref->type = $result->idPrincipal;
} else {
$ref->label = '';
$ref->type = 0;
}
} catch(\Doctrine\DBAL\DBALException $e) {
if ($this->logger !== null) {
$this->logger->error($e->getMessage());
}
}
} else {
$ref->label = 'Identifiant local';