PHP Classes

File: examples/library/www/edition_edit.php

Recommend this page to a friend!
  Classes of Victor Bolshov   Tiny PHP ORM Framework   examples/library/www/edition_edit.php   Download  
File: examples/library/www/edition_edit.php
Role: Example script
Content type: text/plain
Description: Example script
Class: Tiny PHP ORM Framework
Map objects to databases using composed queries
Author: By
Last change:
Date: 8 years ago
Size: 845 bytes
 

Contents

Class file image Download
<?php

use \library\Registry,
    \
library\scaffold\Edition;

include
__DIR__ . "/../bootstrap.php";

if (empty(
$_GET["id"])) {
    if (empty(
$_GET["book_id"])) {
        die(
"No book ID provided");
    }
   
$edition = new Edition();
   
$edition->book_id = (int) $_GET["book_id"];
} else {
   
$edition = Registry::persistenceDriver()->find((int) $_GET["id"], new Edition());
    if (!
$edition) {
        die(
"Edition ID #" . (int) $_GET["id"] . " not found");
    }
}

$title = $edition->id ? "Edit book edition" : "Add book edition";

echo \
library\View::render("header.php", [
   
"title" => "Tinyorm Library: $title",
   
"description" => \library\View::render("sidebar/edition_edit.html"),
]);

echo \
library\View::render(
   
"edition_edit.php",
    [
       
"edition" => $edition,
    ]
);

echo \
library\View::render("footer.php"); ?>