1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
else
{
$request = Request::createFromGlobals();
$em = $this->getDoctrine()->getEntityManager();
$platform = $request->query->get('platform');
$id=$request->query->get('id');
$userManager = $this->container->get('fos_user.user_manager');
$user = $userManager->findUserBy(array('id' =>$id));
if($user)
{
foreach($user->getTeams() as $teams)
{
foreach($teams->getBuilds() as $builds)
{
foreach ($builds->getApplication() as $applications)
{
//je n'arrive pas à lier $applications pour la comparer avec la platform
//guetter depuis l'url
$applications = $em->getRepository('BetappliApplicationBundle:Application')->findByPlatform($platform);
if(!$applications) {
$xml = $serializer->serialize(array('error' => $error), 'xml');
return new Response($xml);
}
foreach ($applications as $application) {
foreach ($application->getBuilds() as $build) {
$Date=$build->getUploadDate();
$dt= new DateTimeToArrayTransformer();
$d=$dt->transform($Date);
$id=$build->getId();
$dir =$build->getUploadRootDir();
if($platform=='Android'){
$fileName=$build->id.'.apk';
}
else
{
$fileName=$build->id.'.ipa';
}
$xml[]=array('application'=>array_merge(array('@id'=>$application->getId(),'name'=>$application->getapplicationName(),'icon'=>$application->getAbsolutePath_icon()),array('build'=>(array('@id'=>$build->getId(),'name'=>$build->getbuildName(),'upload' => $build->getUploadRootDir_build($fileName),
'uploaddate' => $d)))));
}
}
$xml = $serializer->serialize(array('application'=>$xml), 'xml');
return new Response($xml);
}}}
}
else
{
$xml = $serializer->serialize(array('error' => $error2), 'xml');
return new Response($xml);
}
} |
Partager