Subject | Hash | Author | Date (UTC) |
---|---|---|---|
change boolean to bool and add /neo/fastest?hazardous=(true|false) | aa0b6fc0d2ab78404e4677863aafae1dd27bead0 | Ivaylo Iliev | 2017-08-27 21:07:44 |
fix cases | 7fd7024355b538de353f032f69f8e4a1ee5f0b6b | Ivaylo Iliev | 2017-08-27 20:56:14 |
/neo/hazardous | 61f9c4506a8ddf037f6cd670afdaa4f38f44829c | Ivaylo Iliev | 2017-08-27 20:54:40 |
cleanup | 98f98692a290d3cd6e76b36e48be6610754640db | Ivaylo Iliev | 2017-08-27 20:54:24 |
update nasa.start with parameters | 4cec4383b574a0ac874e463cacfc006fb001f14c | Ivaylo Iliev | 2017-08-27 20:32:01 |
import from api | 41affca95695f99674971d59dc3e098ef54a934b | Ivaylo Iliev | 2017-08-27 19:34:49 |
initialize on first run | a7eb6521e87bf6f7fc8ac746db7241300473b549 | Ivaylo Iliev | 2017-08-27 17:26:30 |
update build scripts | 0ca23c79e7f0c2e0a2beae8ea676d1bc6c6c237f | Ivaylo Iliev | 2017-08-27 16:23:17 |
neo bundle, neo entity, empty command | 5df95da9f7d462e891685b5556abeae1abdd28b4 | Ivaylo Iliev | 2017-08-27 16:11:31 |
add mysql | 798d32267444f4f26ce9215817720217970c5e06 | Ivaylo Iliev | 2017-08-27 14:33:00 |
run and build script | a91daf3d789ac334eca951731504f1a17e79952d | Ivaylo Iliev | 2017-08-27 10:52:34 |
remove security checks | 613463e0180c3e812194b0bac40aaef508d99823 | Ivaylo Iliev | 2017-08-27 10:52:12 |
add nasa api key | a4f8c147880e69994a988a176298ed54dacc53db | Ivaylo Iliev | 2017-08-27 08:45:17 |
hello world json | 636f0cca5234693152d25e8a6f7f2e812b39fa16 | Ivaylo Iliev | 2017-08-27 08:29:56 |
empty symfony app | 9c121393c6caf39150b1eeaa274c978edef1425e | Ivaylo Iliev | 2017-08-26 23:05:32 |
update default nginx config | 87638100759fe5cec69d45fbbcf7bbda3464131a | Ivaylo Iliev | 2017-08-26 23:03:30 |
Initial commit | f0ac3b6d6f330c3ed2e5c760a30abf15601d0494 | Ivaylo Iliev | 2017-08-26 22:23:30 |
File | Lines added | Lines deleted |
---|---|---|
src/nasa/src/NeoBundle/Controller/DefaultController.php | 17 | 0 |
src/nasa/src/NeoBundle/Entity/Neo.php | 3 | 3 |
src/nasa/src/NeoBundle/Repository/NeoRepository.php | 18 | 1 |
File src/nasa/src/NeoBundle/Controller/DefaultController.php changed (mode: 100644) (index 6d0f0b5..380ab90) | |||
3 | 3 | namespace NeoBundle\Controller; | namespace NeoBundle\Controller; |
4 | 4 | ||
5 | 5 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
6 | use Symfony\Component\HttpFoundation\Request; | ||
6 | 7 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
7 | 8 | ||
8 | 9 | class DefaultController extends Controller | class DefaultController extends Controller |
... | ... | class DefaultController extends Controller | |
22 | 23 | ||
23 | 24 | return $this->json($hazardous); | return $this->json($hazardous); |
24 | 25 | } | } |
26 | |||
27 | /** | ||
28 | * The fastest ateroid | ||
29 | * | ||
30 | * Calculate and return the model of the fastest ateroid | ||
31 | * | ||
32 | * @Route("/neo/fastest") | ||
33 | * @return \Symfony\Component\HttpFoundation\Response | ||
34 | */ | ||
35 | public function fastestAction(Request $request) | ||
36 | { | ||
37 | $neoRepository = $this->get('neo.repository'); | ||
38 | $fastest = $neoRepository->findFastest($request->get('hazardous', false)); | ||
39 | |||
40 | return $this->json($fastest); | ||
41 | } | ||
25 | 42 | } | } |
File src/nasa/src/NeoBundle/Entity/Neo.php changed (mode: 100644) (index 3d0f364..4ee1223) | |||
... | ... | class Neo implements \JsonSerializable | |
56 | 56 | private $speed; | private $speed; |
57 | 57 | ||
58 | 58 | /** | /** |
59 | * @var boolean | ||
59 | * @var bool | ||
60 | 60 | * | * |
61 | 61 | * @ORM\Column(name="is_hazardous", type="boolean") | * @ORM\Column(name="is_hazardous", type="boolean") |
62 | 62 | */ | */ |
... | ... | class Neo implements \JsonSerializable | |
209 | 209 | /** | /** |
210 | 210 | * Set isHazardous | * Set isHazardous |
211 | 211 | * | * |
212 | * @param boolean $isHazardous | ||
212 | * @param bool $isHazardous | ||
213 | 213 | * | * |
214 | 214 | * @return Neo | * @return Neo |
215 | 215 | */ | */ |
... | ... | class Neo implements \JsonSerializable | |
223 | 223 | /** | /** |
224 | 224 | * Get isHazardous | * Get isHazardous |
225 | 225 | * | * |
226 | * @return boolean | ||
226 | * @return bool | ||
227 | 227 | */ | */ |
228 | 228 | public function getIsHazardous() | public function getIsHazardous() |
229 | 229 | { | { |
File src/nasa/src/NeoBundle/Repository/NeoRepository.php changed (mode: 100644) (index 5d6b10e..5f7d2d0) | |||
... | ... | class NeoRepository extends EntityRepository | |
27 | 27 | return $queryBuilder->getQuery()->getResult(); | return $queryBuilder->getQuery()->getResult(); |
28 | 28 | } | } |
29 | 29 | ||
30 | public function referenceExists($reference) | ||
30 | /** | ||
31 | * @return mixed | ||
32 | */ | ||
33 | public function findFastest(bool $isHazardous = false) | ||
34 | { | ||
35 | return $this->createQueryBuilder('n') | ||
36 | ->where('n.isHazardous=:isHazardous') | ||
37 | ->setParameter('isHazardous', $isHazardous) | ||
38 | ->orderBy('n.speed', 'desc') | ||
39 | ->setMaxResults(1) | ||
40 | ->getQuery() | ||
41 | ->getResult(); | ||
42 | } | ||
43 | |||
44 | /** | ||
45 | * @return bool | ||
46 | */ | ||
47 | public function referenceExists(int $reference) | ||
31 | 48 | { | { |
32 | 49 | return $this->createQueryBuilder('n') | return $this->createQueryBuilder('n') |
33 | 50 | ->select('count(n.id)') | ->select('count(n.id)') |