Subject | Hash | Author | Date (UTC) |
---|---|---|---|
/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 | 11 | 3 |
src/nasa/src/NeoBundle/Entity/Neo.php | 12 | 1 |
src/nasa/src/NeoBundle/Repository/NeoRepository.php | 2 | 2 |
File src/nasa/src/NeoBundle/Controller/DefaultController.php changed (mode: 100644) (index b8024d2..7f0b5e1) | |||
... | ... | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | |
8 | 8 | class DefaultController extends Controller | class DefaultController extends Controller |
9 | 9 | { | { |
10 | 10 | /** | /** |
11 | * @Route("/neo") | ||
11 | * potentially hazardous asteroids | ||
12 | * | ||
13 | * display all DB entries which contain potentially hazardous asteroids | ||
14 | * | ||
15 | * @Route("/neo/hazardous") | ||
16 | * @return \Symfony\Component\HttpFoundation\Response | ||
12 | 17 | */ | */ |
13 | public function indexAction() | ||
18 | public function hazardousAction() | ||
14 | 19 | { | { |
15 | return $this->render('NeoBundle:Default:index.html.twig'); | ||
20 | $neoRepository = $this->get('neo.repository'); | ||
21 | $hazardous = $neoRepository->findAllHazardous(); | ||
22 | |||
23 | return $this->json($hazardous); | ||
16 | 24 | } | } |
17 | 25 | } | } |
File src/nasa/src/NeoBundle/Entity/Neo.php changed (mode: 100644) (index fd94ec6..3d0f364) | |||
... | ... | use Doctrine\ORM\Mapping as ORM; | |
9 | 9 | * @ORM\Table(name="neo") | * @ORM\Table(name="neo") |
10 | 10 | * @ORM\Entity(repositoryClass="NeoBundle\Repository\NeoRepository") | * @ORM\Entity(repositoryClass="NeoBundle\Repository\NeoRepository") |
11 | 11 | */ | */ |
12 | class Neo | ||
12 | class Neo implements \JsonSerializable | ||
13 | 13 | { | { |
14 | 14 | /** | /** |
15 | 15 | * @var id | * @var id |
... | ... | class Neo | |
229 | 229 | { | { |
230 | 230 | return $this->isHazardous; | return $this->isHazardous; |
231 | 231 | } | } |
232 | |||
233 | public function jsonSerialize() | ||
234 | { | ||
235 | return array( | ||
236 | 'reference' => $this->getReference(), | ||
237 | 'name' => $this->getName(), | ||
238 | 'approachAt' => $this->getApproachAt(), | ||
239 | 'speed' => $this->getSpeed(), | ||
240 | 'isHazardous'=> $this->getIsHazardous(), | ||
241 | ); | ||
242 | } | ||
232 | 243 | } | } |
File src/nasa/src/NeoBundle/Repository/NeoRepository.php changed (mode: 100644) (index 1347f20..5d6b10e) | |||
... | ... | class NeoRepository extends EntityRepository | |
22 | 22 | { | { |
23 | 23 | $queryBuilder = $this->createQueryBuilder('n'); | $queryBuilder = $this->createQueryBuilder('n'); |
24 | 24 | ||
25 | $queryBuilder->where('u.isHazardous is true'); | ||
25 | $queryBuilder->where('n.isHazardous = true'); | ||
26 | 26 | ||
27 | return $queryBuilder->getQuery()->getResults(); | ||
27 | return $queryBuilder->getQuery()->getResult(); | ||
28 | 28 | } | } |
29 | 29 | ||
30 | 30 | public function referenceExists($reference) | public function referenceExists($reference) |