movies
with the following fields:id
unsigned
int
auto_increment
primary key
title
varchar
summary
text
year
year
dateAdded
datetime
directorId
unsigned
int
directors
table.You can get an SQL script to create this table in the Cherrycake documentation examples repository, in the/install/database/movies.sql
file.
Movie
class in the file /classes/Movie.class.php
, and it looks like this:tableName
The name of the table where the items are stored.fields
A hash array to specify the field names and field types of the table. See Database constants for all the available field types. See Item::$fields for more keys you can use here to customize how your Item works.databaseProviderName
The database provider name where this items are stored. The default is main
idFieldName
The name of the field that contains values to uniquely identify each item in the table. Defaults to id
Movie
class? Let's see how to create a Movie
object we can manipulate. Let's say we want to load the movie with id 15
: