示例#1
0
文件: Page.php 项目: nhebi/cms
 public function save(PageEntity $page)
 {
     $now = new \DateTime('now');
     // Created
     if (!$page->getCreated()) {
         $page->setCreated($now);
     }
     // The updated datetime
     $page->setUpdated($now);
     $this->getEntityManager()->persist($page);
     $this->getEntityManager()->flush();
 }
示例#2
0
文件: PageTest.php 项目: nhebi/cms
 public function testSetters()
 {
     $page = new Page();
     $page->setTitle('Imprint');
     $this->assertEquals('Imprint', $page->getTitle());
     $page->setRoute('imprint');
     $this->assertEquals('imprint', $page->getRoute());
     $page->setContent('lorem ipsum');
     $this->assertEquals('lorem ipsum', $page->getContent());
     $page->setStatus('published');
     $this->assertEquals('published', $page->getStatus());
     $now = new \DateTime('now');
     $page->setCreated($now);
     $this->assertEquals($now, $page->getCreated());
     $page->setUpdated($now);
     $this->assertEquals($now, $page->getUpdated());
 }