예제 #1
0
 public function testGetDataWithNull()
 {
     $pageClass = new PageEntity();
     $pageClass->setUrl('url');
     $pageArray = array('url' => 'url');
     $this->assertEquals($pageArray, $this->em->getData($pageClass));
 }
예제 #2
0
 public function add()
 {
     if ($_SERVER['REQUEST_METHOD'] === 'POST') {
         $entity = new PageEntity();
         $entity->setTitle($_POST['title'])->setContent($_POST['content'])->setDateAdded(date('Y-m-d H:i:s'));
         $pageCollection = new PageCollection();
         $pageCollection->save($entity);
         header('Location: index.php?c=page');
         exit;
     }
     $this->loadView('page/add');
 }
예제 #3
0
 public function edit()
 {
     $pages_collection = new PagesCollection();
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         $page = new PageEntity();
         $page->setId($_GET['id']);
         $page->setTitle($_POST['title']);
         $page->setContent($_POST['content']);
         $pages_collection->save($page);
         header('Location: index.php?controller=pages');
     }
     $data = $pages_collection->get($_GET['id']);
     $this->loadView('cms/pages_edit', array('data' => $data));
 }
예제 #4
0
파일: index.php 프로젝트: skvaros/test
<?php

require_once "./Model/entity/PageEntity.php";
$page = new PageEntity();
$page->setId(2);
$page->setUrl('url');
echo $page->getId();
echo "<br />";
echo $page->getUrl();
예제 #5
0
파일: test.php 프로젝트: skvaros/test
<?php

require_once "./entity/PageEntity.php";
$page = new PageEntity(array('id' => 1));
print_r($page->toArray());