| @@ 186-206 (lines=21) @@ | ||
| 183 | * |
|
| 184 | * @return array |
|
| 185 | */ |
|
| 186 | public function getSections($id) |
|
| 187 | { |
|
| 188 | $sections = $this->em->getRepository('Newscoop\PaywallBundle\Entity\Section') |
|
| 189 | ->findBy(array( |
|
| 190 | 'subscription' => $id, |
|
| 191 | )); |
|
| 192 | ||
| 193 | $sectionsArray = array(); |
|
| 194 | foreach ($sections as $section) { |
|
| 195 | $sectionsArray[] = array( |
|
| 196 | 'id' => $section->getId(), |
|
| 197 | 'name' => $section->getName(), |
|
| 198 | 'language' => $section->getLanguage()->getName(), |
|
| 199 | 'date' => $section->getStartDate(), |
|
| 200 | 'days' => $section->getDays(), |
|
| 201 | 'paid' => $section->getPaidDays(), |
|
| 202 | ); |
|
| 203 | } |
|
| 204 | ||
| 205 | return $sectionsArray; |
|
| 206 | } |
|
| 207 | ||
| 208 | /** |
|
| 209 | * Gets user's subscriptions for articles by given Id. |
|
| @@ 215-235 (lines=21) @@ | ||
| 212 | * |
|
| 213 | * @return array |
|
| 214 | */ |
|
| 215 | public function getArticles($id) |
|
| 216 | { |
|
| 217 | $articles = $this->em->getRepository('Newscoop\PaywallBundle\Entity\Article') |
|
| 218 | ->findBy(array( |
|
| 219 | 'subscription' => $id, |
|
| 220 | )); |
|
| 221 | ||
| 222 | $articlesArray = array(); |
|
| 223 | foreach ($articles as $article) { |
|
| 224 | $articlesArray[] = array( |
|
| 225 | 'id' => $article->getId(), |
|
| 226 | 'name' => $article->getName(), |
|
| 227 | 'language' => $article->getLanguage()->getName(), |
|
| 228 | 'date' => $article->getStartDate(), |
|
| 229 | 'days' => $article->getDays(), |
|
| 230 | 'paid' => $article->getPaidDays(), |
|
| 231 | ); |
|
| 232 | } |
|
| 233 | ||
| 234 | return $articlesArray; |
|
| 235 | } |
|
| 236 | ||
| 237 | /** |
|
| 238 | * Gets currently added user's Sections by given language Id and subscription Id. |
|