Ejemplo n.º 1
0
 /**
  * Save settings
  *
  * @param Newscoop\News\Item $item
  * @return void
  */
 public function save(array $values, Settings $settings)
 {
     $settings->setArticleTypeName($values['article_type']);
     $settings->setPublicationId($values['publication']);
     $settings->setSectionNumber($values['section']);
     $this->odm->persist($settings);
     $this->odm->flush();
 }
 public function testTwoDiferentManager()
 {
     $meta = $this->dm1->getClassMetadata('Sluggable\\Fixture\\Document\\Article');
     $dmArticle = new \Sluggable\Fixture\Document\Article();
     $dmArticle->setCode('code');
     $dmArticle->setTitle('title');
     $this->dm1->persist($dmArticle);
     $this->dm1->flush();
     $this->assertEquals('title-code', $dmArticle->getSlug());
     $em1Article = new \Sluggable\Fixture\Article();
     $em1Article->setCode('code');
     $em1Article->setTitle('title');
     $this->em1->persist($em1Article);
     $this->em1->flush();
     $this->assertEquals('title-code', $em1Article->getSlug());
 }
Ejemplo n.º 3
0
 /**
  * Publish package item
  *
  * @param Newscoop\News\PackageItem $item
  * @return void
  */
 private function publishPackage(PackageItem $item)
 {
     $root = $item->getGroupSet()->getRootGroup();
     foreach ($root->getRefs() as $ref) {
         $this->publishGroup($ref, $item);
     }
     $item->setPublished(new \DateTime());
     $this->odm->flush();
 }