Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 6f7822b0 authored by NINASSI Benjamin's avatar NINASSI Benjamin
Browse files

adding some controle

parent 305ea826
Branches
No related tags found
No related merge requests found
...@@ -73,22 +73,46 @@ class ImportStructuresFromJsonCommand extends ContainerAwareCommand ...@@ -73,22 +73,46 @@ class ImportStructuresFromJsonCommand extends ContainerAwareCommand
$type = ltrim(rtrim($data_structure['type'])); $type = ltrim(rtrim($data_structure['type']));
$name = ltrim(rtrim($data_structure['name'])); $name = ltrim(rtrim($data_structure['name']));
if($type && $name){ if($type && $name){
if($data_structure['logo']){
$logo = ltrim(rtrim($data_structure['logo'])); $logo = ltrim(rtrim($data_structure['logo']));
$url = ltrim(rtrim($data_structure['url'])); }else{
$who = ltrim(rtrim($data_structure['who'])); $logo ="";
$address = ltrim(rtrim($data_structure['address'])); }
$location = $data_structure['location']; if($data_structure['url']){
if($location && is_array($location)){ $url = ltrim(rtrim($data_structure['url']));
$lat = ltrim(rtrim($location['lat'])); }else{
$long = ltrim(rtrim($location['lng'])); $url="";
}
if($data_structure['who']){
$who = ltrim(rtrim($data_structure['who']));
}else{
$who = "";
}
if($data_structure['address']){
$address = ltrim(rtrim($data_structure['address']));
}else{
$address="";
}
if($data_structure['location']){
$location = $data_structure['location'];
if($location && is_array($location) && $location['lat'] && $location['lng']){
$lat = ltrim(rtrim($location['lat']));
$long = ltrim(rtrim($location['lng']));
}else{
$lat = 0;
$long = 0;
}
}else{ }else{
$lat = 0; $lat = 0;
$long = 0; $long = 0;
} }
$email = ltrim(rtrim($data_structure['email'])); if($data_structure['email']){
$email = ltrim(rtrim($data_structure['email']));
}else{
$email="";
}
$structure = $em->getRepository('ClassCodeBundle:Structure')->findOneBy(array('name' => $name,'type' => $type) ); $structure = $em->getRepository('ClassCodeBundle:Structure')->findOneBy(array('name' => $name,'mainType' => $type) );
if(!$structure){ if(!$structure){
$structure = new Structure(); $structure = new Structure();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment