Hols
Agile Development
MODEL
Symfony uses, by default, Propel as the ORM and Creole as the database abstraction layer.
More about propel:http://propel.phpdb.org/docs/user_guide/
DATABASES SUPPORTED (Creole)
MySQL
PostgreSQL
Oracle
SQLServer
SQLITE
Creole Column Types
MODEL CLASSES
The schema is used to build the model classes of the ORM layerthrough the
command-line task: $ symfony propel-build-model
BASE CLASSES
CONNECT TO DATABASE
lib/model/om/
BaseArticle.php
BaseArticlePeer.php
propel.ini
BaseComment.phpBaseCommentPeer.php
/myproject/config
propel.targetPackage
= lib.model
propel.packageObjectModel = true
propel.project
= myproject
propel.database
= mysql
propel.database.createUrl =mysql://localhost/
propel.database.url
= mysql://localhost/myproject
...
Base classes are the ones directly generated from the schema. Never
modify them, since every new build of the model will completelyerase
these files.
databases.yml
Inherit from the Base ones. When the propel-build-model task is called on
an existing model, these classes are not modified. So this is where you can
addcustom methods and properties to the model objects.
prod:
propel:
param:
host:
username:
password:
/myproject/config
Article.php
ArticlePeer.php
lib/model/
Comment.php
CommentPeer.phpIt inherits all the methods of the BaseArticle class, but a modification in
the model will not affect it.
Article.php
Comment.php
sfPropelDatabase
OBJECT CLASSES
mysql
localhost
bloglogin
passwd
80
utf8
true
Represent a record in the database. They give access to the columns of a
record and to related records.
Object Class Constructor - new
To create a new object:$myobject = new MyTable();
The methods of the Peer classes will be called with a :: (for static method
call) instead of the usual -> (for instance method call)
Retrieving Records by Primary Key...
Regístrate para leer el documento completo.