Wednesday, March 26, 2008

symfony simple blog plugin conflict

if you use symfony simple blog plugin ( sfSimpleBlog )
you cannot define your other php name as Job in schema, ie:

jobs:
_attributes: { phpName: Job, idMethod: native }

you can use jobs as below or change to something else

jobs:
_attributes: { phpName: Jobs, idMethod: native }

otherwise you will not be able to load the simple blog admin after you
rebuild the model

Thursday, March 20, 2008

how to deal with enum in symfony

type: enum

Simulating an enum column type in the model

As enum is a MySQL specific type, you cannot have a column of type
enum in your schema.yml (which is database-independent). One solution
to simulate it is to create another table to store the different
possible values. But the Model class offer an alternative solution
that is probably more elegant.

please see detail on: http://www.symfony-project.org/snippets/snippet/107

useful docs of symfony

URL http://andreiabohner.files.wordpress.com/2007/08/sfmodelfirstpartrefcard.pdf
this is about database model, the files, locations and etc

URL http://andreiabohner.files.wordpress.com/2007/09/sfmodelsecondpartrefcard.pdf
this is about database schema, it's a detailed example of schema.yml with explanation of  each item.

URL http://andreiabohner.files.wordpress.com/2008/01/sfmodelcriteriacriterionrsrefcard_enus.pdf
this is about the criteria / criterion / RS
full doc and example

useful docs of symfony

refer to http://pools.jp/2007/06/24/symfony-schema-yml-propel-%E6%8A%BD%E8%B1%A1%E8%A1%A8%E7%8F%BE/
source is Japanese, it's about how the schema.yml defines the column types. Simple form is copied from the source below, for more details, refer to the source.


mysql symfony(schema.yml)
varchar VARCHAR
tinyint TINYINT
text LONGVARCHAR
date DATE
smallint SMALLINT
mediumint SMALLINT
int INTEGER
bigint BIGINT
float FLOAT
datetime TIMESTAMP
timestamp TIMESTAMP
time TIME
year INTEGER
char CHAR
tinybolb BINARY
tinytext VARCHAR
blob VARBINARY
mediumbob VARBINARY
mediumtext LONGVARCHAR
longblob VARBINARY
longtext LONGVARCHAR
enum CHAR
set CHAR
bool TINYINT
decimal DECIMAL

Tuesday, March 11, 2008

symfony propel-load-data

symfony propel-load-data

Loading data from fixtures can be extremely useful to pre-populate
your database so you have something to test and code with. I
frequently use the propel-load-data task in two ways, the first when
altering the schema, and the second to add some new data on top of
whats in the database.

This will rebuild your db and model from schema.yml, insert the new
structure into your db, and load data from the fixtures in
/data/fixtures:

./symfony propel-build-all-load frontend

To load in additional data from a specific fixture file, you can use
this command:

./symfony propel-load-data frontend dev data/fixtures/[filename].yml append

Tuesday, March 04, 2008

symfony sfGuard

when install the plugin sfGuard, if you have problem when running
propel-load-data to import the init data.
use the following command:
symfony propel-load-data frontend

the common error is asking for the app name, but if you use your
project name you'll remain the error. so use frontend instead of you
project name.