| @@ 51-62 (lines=12) @@ | ||
| 48 | * @return \TheSportsDb\Entity\SportInterface |
|
| 49 | * The sport. |
|
| 50 | */ |
|
| 51 | public function getSport($name) { |
|
| 52 | $entity = $this->entityManager->repository('sport')->byId($name); |
|
| 53 | if ($entity instanceof ProxyInterface) { |
|
| 54 | try { |
|
| 55 | $entity->load(); |
|
| 56 | } |
|
| 57 | catch (\Exception $e) { |
|
| 58 | return FALSE; |
|
| 59 | } |
|
| 60 | } |
|
| 61 | return $entity; |
|
| 62 | } |
|
| 63 | ||
| 64 | /** |
|
| 65 | * Gets all leagues. |
|
| @@ 83-94 (lines=12) @@ | ||
| 80 | * @return \TheSportsDb\Entity\LeagueInterface |
|
| 81 | * The league. |
|
| 82 | */ |
|
| 83 | public function getLeague($leagueId) { |
|
| 84 | $entity = $this->entityManager->repository('league')->byId($leagueId); |
|
| 85 | if ($entity instanceof ProxyInterface) { |
|
| 86 | try { |
|
| 87 | $entity->load(); |
|
| 88 | } |
|
| 89 | catch (\Exception $e) { |
|
| 90 | return FALSE; |
|
| 91 | } |
|
| 92 | } |
|
| 93 | return $entity; |
|
| 94 | } |
|
| 95 | ||
| 96 | /** |
|
| 97 | * Gets all leagues by country. |
|
| @@ 146-157 (lines=12) @@ | ||
| 143 | * @return \TheSportsDb\Entity\TeamInterface |
|
| 144 | * The team. |
|
| 145 | */ |
|
| 146 | public function getTeam($teamId) { |
|
| 147 | $entity = $this->entityManager->repository('team')->byId($teamId); |
|
| 148 | if ($entity instanceof ProxyInterface) { |
|
| 149 | try { |
|
| 150 | $entity->load(); |
|
| 151 | } |
|
| 152 | catch (\Exception $e) { |
|
| 153 | return FALSE; |
|
| 154 | } |
|
| 155 | } |
|
| 156 | return $entity; |
|
| 157 | } |
|
| 158 | ||
| 159 | /** |
|
| 160 | * Gets a team by name. |
|
| @@ 222-233 (lines=12) @@ | ||
| 219 | * @return \TheSportsDb\Entity\PlayerInterface |
|
| 220 | * The player. |
|
| 221 | */ |
|
| 222 | public function getPlayer($playerId) { |
|
| 223 | $entity = $this->entityManager->repository('player')->byId($playerId); |
|
| 224 | if ($entity instanceof ProxyInterface) { |
|
| 225 | try { |
|
| 226 | $entity->load(); |
|
| 227 | } |
|
| 228 | catch (\Exception $e) { |
|
| 229 | return FALSE; |
|
| 230 | } |
|
| 231 | } |
|
| 232 | return $entity; |
|
| 233 | } |
|
| 234 | ||
| 235 | /** |
|
| 236 | * Get a players by team id. |
|
| @@ 298-309 (lines=12) @@ | ||
| 295 | * @return \TheSportsDb\Entity\EventInterface |
|
| 296 | * The event. |
|
| 297 | */ |
|
| 298 | public function getEvent($eventId) { |
|
| 299 | $entity = $this->entityManager->repository('event')->byId($eventId); |
|
| 300 | if ($entity instanceof ProxyInterface) { |
|
| 301 | try { |
|
| 302 | $entity->load(); |
|
| 303 | } |
|
| 304 | catch (\Exception $e) { |
|
| 305 | return FALSE; |
|
| 306 | } |
|
| 307 | } |
|
| 308 | return $entity; |
|
| 309 | } |
|
| 310 | ||
| 311 | /** |
|
| 312 | * Get events by name. |
|