PHP Classes

File: examples/library/www/author_save.php

Recommend this page to a friend!
  Classes of Victor Bolshov   Tiny PHP ORM Framework   examples/library/www/author_save.php   Download  
File: examples/library/www/author_save.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: 364 bytes
 

Contents

Class file image Download
<?php

use \library\Author,
    \
library\Registry;

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

$author = new Author($_POST);
$author->id = ((int) $author->id) ?: null;
$author->name = trim((string) $author->name);

if (
$author->name) {
   
Registry::persistenceDriver()->save($author);
   
header("Location: authors.php");
    exit;
} else {
    echo
"Empty name";
}