getNumber() 공개 메소드

Get number.
public getNumber ( ) : integer
리턴 integer
 /**
  * Add new related article to related articles container
  *
  * @param Article $article
  * @param Article $articleToAdd
  * @param integer $position
  *
  * @return boolean
  */
 public function addArticle($article, $articleToAdd, $position = false)
 {
     $relatedArticles = $this->findRelatedArticlesBox($article);
     $relatedArticle = $this->em->getRepository('Newscoop\\Entity\\RelatedArticle')->getRelatedArticle($relatedArticles, $articleToAdd->getNumber())->getOneOrNullResult();
     if ($relatedArticle) {
         $this->positionRelateArticle($relatedArticles, $relatedArticle, $position);
         return true;
     }
     $relatedArticle = new RelatedArticle($relatedArticles->getId(), $articleToAdd->getNumber());
     $this->em->persist($relatedArticle);
     $this->em->flush();
     $this->positionRelateArticle($relatedArticles, $relatedArticle, $position);
     return true;
 }
예제 #2
0
 /**
  * @param \Doctrine\ORM\EntityManager                                           $em
  * @param \Symfony\Bundle\FrameworkBundle\Templating\EngineInterface            $templating
  * @param \Newscoop\Entity\Article                                              $article
  * @param \Newscoop\ArticlesBundle\Entity\Repository\EditorialCommentRepository $repository
  */
 public function let($die, $em, $templating, $article, $repository, Registry $doctrine)
 {
     $doctrine->getManager()->willReturn($em);
     $em->getRepository(Argument::exact('Newscoop\\ArticlesBundle\\Entity\\EditorialComment'))->willReturn($repository);
     $repository->getAllByArticleNumber(Argument::any(), Argument::any())->willReturn(Argument::any());
     $article->getNumber()->willReturn(1);
     $this->beConstructedWith($em, $templating);
 }
예제 #3
0
 /**
  * @param Newscoop\Subscription\Subscription $subscription
  * @param int $article
  */
 public function __construct(Subscription $subscription, ArticleEntity $article)
 {
     $this->subscription = $subscription;
     $this->subscription->addArticle($this);
     $this->article = $article;
     $this->articleNumber = $article->getNumber();
     $this->noticeSent = 'N';
     $this->paidDays = 0;
 }
예제 #4
0
 public function let(TraceableEventDispatcher $dispatcher, EntityManager $em, Article $article, Language $language)
 {
     $article->getNumber()->willReturn(10);
     $article->getName()->willReturn("test article");
     $article->getPublicationId()->willReturn(2);
     $article->getLanguageId()->willReturn(1);
     $article->getIssueId()->willReturn(20);
     $article->getSectionId()->willReturn(30);
     $em->getReference('Newscoop\\Entity\\Language', 1)->willReturn($language);
     $language->getCode()->willReturn('en');
     $this->beConstructedWith($dispatcher, $em);
 }
 public function let(EntityManager $em, Article $article, Article $articleToRemove, Article $articleToAdd, RelatedArticles $relatedArticles, RelatedArticle $relatedArticle, RelatedArticleRepository $relatedArticleRepository, RelatedArticlesRepository $relatedArticlesRepository, AbstractQuery $query, AbstractQuery $getRelatedArticleQuery, AbstractQuery $getAllArticlesQuery, \Doctrine\DBAL\Connection $connection)
 {
     $article->getNumber()->willReturn(1);
     $articleToRemove->getNumber()->willReturn(2);
     $articleToAdd->getNumber()->willReturn(2);
     $em->persist(Argument::any())->willReturn(true);
     $em->flush(Argument::any())->willReturn(true);
     $em->remove(Argument::any())->willReturn(true);
     $em->getConnection()->willReturn($connection);
     $em->getRepository('Newscoop\\Entity\\RelatedArticle')->willReturn($relatedArticleRepository);
     $em->getRepository('Newscoop\\Entity\\RelatedArticles')->willReturn($relatedArticlesRepository);
     $relatedArticlesRepository->getRelatedArticles(Argument::type('integer'))->willReturn($query);
     $relatedArticleRepository->getAllArticles(Argument::type('\\Newscoop\\Entity\\RelatedArticles'))->willReturn($getAllArticlesQuery);
     $getAllArticlesQuery->getResult()->willReturn(array());
     $relatedArticleRepository->getRelatedArticle(Argument::type('\\Newscoop\\Entity\\RelatedArticles'), Argument::type('integer'))->willReturn($query);
     $relatedArticleRepository->getRelatedArticle(Argument::type('integer'))->willReturn($getRelatedArticleQuery);
     $getRelatedArticleQuery->getOneOrNullResult()->willReturn($relatedArticle);
     $relatedArticle->getOrder()->willReturn(Argument::type('integer'));
     $this->beConstructedWith($em);
 }
예제 #6
0
 private function createArticleLegacyPreviewUrl(Article $article)
 {
     $params = array('f_publication_id' => $article->getPublicationId(), 'f_issue_number' => $article->getIssueId(), 'f_section_number' => $article->getSectionId(), 'f_article_number' => $article->getNumber(), 'f_language_id' => $article->getLanguageId(), 'f_language_selected' => $article->getLanguageId());
     return '/admin/articles/get.php?' . http_build_query($params);
 }
예제 #7
0
 private function getLogArray(Topic $topic, Article $article)
 {
     return array('title' => $topic->getTitle(), 'id' => array('Title' => $article->getName(), 'Number' => $article->getNumber(), 'IdLanguage' => $article->getLanguageId()), 'diff' => array('id' => $topic->getId(), 'title' => $topic->getTitle()));
 }
예제 #8
0
 /**
  * Remove author with type from article
  *
  * @param Article       $article
  * @param Author        $author
  * @param ArticleAuthor $authorType
  *
  * @return ArticleAuthor
  */
 public function removeAuthorFromArticle(Article $article, Author $author, AuthorType $authorType)
 {
     $articleAuthor = $this->em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthor($article->getNumber(), $article->getLanguageCode(), $author->getId(), $authorType->getId())->getOneOrNullResult();
     if (!$articleAuthor) {
         throw new ResourcesConflictException("Author with this type is not attached to article", 409);
     }
     $this->em->remove($articleAuthor);
     $this->em->flush();
     $articleAuthors = $this->em->getRepository('Newscoop\\Entity\\ArticleAuthor')->getArticleAuthors($article->getNumber(), $article->getLanguageCode())->getResult();
     $this->reorderAuthors($this->em, $articleAuthors);
 }
예제 #9
0
 /**
  * Create new article
  *
  * @param string  $articleType
  * @param integer $language
  * @param User    $user
  * @param integer $publication
  * @param array   $attributes
  * @param integer $issue
  * @param integer $section
  *
  * @return Article
  */
 public function createArticle($articleType, $language, $user, $publication, $attributes = array(), $issue = null, $section = null)
 {
     $this->checkForArticleConflicts($attributes['name'], $publication, $issue, $section);
     $article = new Article($this->em->getRepository('Newscoop\\Entity\\AutoId')->getNextArticleNumber(), $language);
     if (!$section) {
         $articleOrder = $article->getNumber();
     } else {
         $minArticleOrder = $this->em->getRepository('Newscoop\\Entity\\Article')->getMinArticleOrder($publication, $issue, $section)->getSingleScalarResult();
         $increment = $minArticleOrder > 0 ? 1 : 2;
         $this->em->getRepository('Newscoop\\Entity\\Article')->updateArticleOrder($increment, $publication, $issue, $section)->getResult();
         $articleOrder = 1;
     }
     $article->setArticleOrder($articleOrder);
     $article->setPublication($publication);
     $article->setType($articleType);
     $article->setCreator($user);
     $article->setIssueId(0);
     $article->setSectionId(0);
     if (!is_null($issue)) {
         $article->setIssueId($issue->getNumber());
         $article->setIssue($issue);
     }
     if (!is_null($section)) {
         $article->setSectionId($section->getNumber());
         $article->setSection($section);
     }
     $this->updateArticleMeta($article, $attributes);
     $article->setCommentsLocked(false);
     //TODO - add this to type
     $article->setWorkflowStatus('N');
     $article->setShortName($article->getNumber());
     $article->setLockTime(null);
     $article->setPublished(new \Datetime());
     $article->setUploaded(new \Datetime());
     $article->setLockUser();
     $article->setPublic('Y');
     $article->setIsIndexed('N');
     $this->em->persist($article);
     $this->em->flush();
     $articleData = new \ArticleData($article->getType(), $article->getNumber(), $article->getLanguageId());
     $articleData->create();
     return $article;
 }
예제 #10
0
 /**
  * Send comment notification
  *
  * @param Newscoop\Entity\Comment $comment
  * @param Newscoop\Entity\Article $article
  * @param array                   $authors
  * @param Newscoop\Entity\User    $user
  *
  * @return void
  */
 public function sendCommentNotification(Comment $comment, Article $article, array $authors, User $user = null)
 {
     $publicationService = $this->container->get('newscoop_newscoop.publication_service');
     $templatesService = $this->container->get('newscoop.templates.service');
     $placeholdersService = $this->container->get('newscoop.placeholders.service');
     $preferencesService = $this->container->get('preferences');
     $translator = $this->container->get('translator');
     $emails = array_unique(array_filter(array_map(function ($author) {
         return $author->getEmail();
     }, $authors)));
     $publication = $publicationService->getPublication();
     $moderatorTo = $this->getModeratorEmailIfModerationEnabled($publication, $user);
     $moderatorTo ? $emails['moderator'] = $moderatorTo : null;
     $moderatorFrom = $publication->getModeratorFrom();
     if (empty($emails)) {
         return;
     }
     $smarty = $templatesService->getSmarty();
     $uri = \CampSite::GetURIInstance();
     if ($user) {
         $smarty->assign('username', $user->getUsername());
     } else {
         $smarty->assign('username', $translator->trans('anonymous'));
     }
     $smarty->assign('comment', $comment);
     $smarty->assign('article', new \MetaArticle($article->getLanguageId(), $article->getNumber()));
     $smarty->assign('publication', $uri->getBase());
     $smarty->assign('site', $uri->getBase());
     $smarty->assign('articleLink', \ShortURL::GetURI($article->getPublicationId(), $article->getLanguageId(), $article->getIssueId(), $article->getSectionId(), $article->getNumber()));
     $message = $templatesService->fetchTemplate("email_comment-notify.tpl");
     $this->send($placeholdersService->get('subject'), $message, $emails, $moderatorFrom ?: $preferencesService->EmailFromAddress);
 }
예제 #11
0
 /**
  * Get event article datetime
  *
  * @param Newscoop\Entity\Article $article
  * @return ArticleDatetime
  */
 public function getArticleDatetime($article)
 {
     return $this->em->getRepository('Newscoop\\Entity\\ArticleDatetime')->findOneBy(array('articleId' => $article->getNumber(), 'fieldName' => 'schedule'));
 }
 public function getNumber()
 {
     if ($this->__isInitialized__ === false) {
         return (int) $this->_identifier["number"];
     }
     $this->__load();
     return parent::getNumber();
 }