Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
148fc615
Commit
148fc615
authored
May 31, 2007
by
pookey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more docs, hopefully my last commit tonight...
parent
9187dbed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
0 deletions
+38
-0
doctrine.xml
manual/docbook/doctrine.xml
+38
-0
No files found.
manual/docbook/doctrine.xml
View file @
148fc615
...
...
@@ -206,6 +206,44 @@
url=
"http://www.martinfowler.com/eaaCatalog/activeRecord.html"
>
Active
Record pattern
</ulink>
</para>
<para>
Doctrine auto-creates database tables and always adds a primary key
column named 'id' to tables that doesn't have any primary keys
specified. Only thing you need to for creating database tables is
defining a class which extends Doctrine_Record and setting a
setTableDefinition method with hasColumn() method calls.
</para>
<para>
An short example:
</para>
<para>
We want to create a database table called 'user' with columns
id(primary key), name, username, password and created. Provided that
you have already installed Doctrine these few lines of code are all you
need:
</para>
<programlisting
role=
"php"
>
<![CDATA[
<?php
require_once('lib/Doctrine.php');
spl_autoload_register(array('Doctrine', 'autoload'));
class User extends Doctrine_Record {
public function setTableDefinition() {
// set 'user' table columns, note that
// id column is always auto-created
$this->
hasColumn('name','string',30);
$this->hasColumn('username','string',20);
$this->hasColumn('password','string',16);
$this->hasColumn('created','integer',11);
}
}
?>]]>
</programlisting>
<para>
We now have a user model that supports basic CRUD opperations!
</para>
</sect1>
</chapter>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment