Ejemplo n.º 1
1
 public function indexAction()
 {
     $movies = Movies::find();
     $this->view->movies = $movies;
 }
Ejemplo n.º 2
0
 public function put_index()
 {
     $data = file_get_contents('php://input');
     $temp = json_decode($data);
     $new = Movies::find($temp->id);
     $new->text = $temp->text;
     $new->parent_id = $temp->parentId;
     $new->save();
     $array = array('success' => 'true');
     $json = json_encode($array);
     return $json;
 }
Ejemplo n.º 3
0
 public function put_index()
 {
     $data = file_get_contents('php://input');
     $temp = json_decode($data);
     $new = Movies::find($temp->id);
     $new->id = $temp->id;
     $new->title = $temp->title;
     $new->director = $temp->director;
     $new->year = $temp->year;
     $new->genre = $temp->genre;
     $new->save();
     $array = array('success' => 'true');
     $json = json_encode($array);
     return $json;
 }
 /**
  * testFindRecordException.
  *
  * Assert that exception is thrown when a table that
  * does not exist is queried
  *
  * @expectedException PDOException
  */
 public function testFindRecordException()
 {
     $movie = Movies::find(101);
     $this->assertFalse($movie);
 }
Ejemplo n.º 5
0
    /**
     *将电影变成internet链接,以便于用everything软件来快速的检索到,这个将来可以将图书也弄成这种形式,方便检索
     */
    private function dumpMoves2internetLinks()
    {
        $movies = Movies::find();
        foreach ($movies as $movie) {
            $title = $movie->title;
            $url = $this->url->get(['for' => 'movies.show', 'movie' => $movie->id]);
            echo $title . '-' . $url . '<br>';
            $data = '[InternetShortcut]
URL=' . $url;
            $filename = 'temp/' . $title . '.url';
            $filename = iconv('UTF-8', 'GBK//IGNORE', preg_replace('|:|', ' ', $filename));
            file_put_contents($filename, $data);
        }
    }