Development

Changeset 6976

You must first sign up to be able to contribute.

Changeset 6976

Show
Ignore:
Timestamp:
01/06/08 17:16:12 (11 months ago)
Author:
fabien
Message:

doc: updated first project tutorial to be compatible with SQLite and MySQL

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • doc/branches/1.1/tutorial/my-first-project.txt

    r6886 r6976  
    77 
    88We'll assume that you are working with Apache installed and launched on your 
    9 localhost. You will also need PHP 5.1.3 or newer with the SQLite extension 
    10 installed and enabled (you can check this in `php.ini` - see how 
    11 [in the PHP documentation](http://fr3.php.net/manual/en/ref.sqlite.php). 
     9localhost. You will also need PHP 5.1.3 or newer. 
    1210 
    1311Install symfony and initialize the project 
     
    2220 
    2321Get it here: [sf_sandbox.tgz](http://www.symfony-project.com/get/sf_sandbox.tgz), 
    24 and unpack it in your root web directory. Refer to the included readme file for more 
     22and unpack it in your root web directory. Refer to the included `README` file for more 
    2523information. The resulting file structure should look like: 
    2624 
     
    10098database from within an object-oriented code without writing a single SQL query. 
    10199By default, symfony uses the Propel library for this purpose. Theses classes are 
    102 part of the **model** of our application (find more in the [model chapter](http://www.symfony-project.com/book/1.1/08-Inside-the-Model-Layer)). 
     100part of the **model** of our application 
     101(find more in the [model chapter](http://www.symfony-project.com/book/1.1/08-Inside-the-Model-Layer)). 
     102 
     103Now, we need to convert the schema to SQL statements to initialize the database tables. 
     104By default, the symfony sandbox is configured to work out of the box with a simple 
     105SQLite file, so no database initialization is required. 
     106You still need to check that the SQLite extension is installed and enabled correctly 
     107(you can check this in `php.ini` - see how 
     108[in the PHP documentation](http://fr3.php.net/manual/en/ref.sqlite.php)). 
     109 
     110By default, the `sf_sandbox` project will use a database file called `sandbox.db` 
     111located in `sf_sandbox/data/`. 
     112 
     113If you want to switch to MySQL for this project, just type the following command line: 
     114 
     115    $ php symfony configure:database mysql://root:pa$$word/localhost/symfony_project 
     116 
     117Change the DSN argument to match your settings (username, password, host, and database name) 
     118and then create the database with the command line or a web interface (as described in 
     119the [model chapter](http://www.symfony-project.com/book/1.1/08-Inside-the-Model-Layer)). 
    103120 
    104121Now type in the command line: 
     
    108125A `lib.model.schema.sql` file is created in `sf_sandbox/data/sql/`. 
    109126The SQL statements found is this file can be used to initialize a database with 
    110 the same table structure. You could create a database in MySQL with the command 
    111 line or a web interface (as described in the 
    112 [model chapter](http://www.symfony-project.com/book/1.1/08-Inside-the-Model-Layer)). 
    113 Luckily, the symfony sandbox is configured to work out of the box with a simple 
    114 SQLite file, so no database initialization is required. By default, the `sf_sandbox` 
    115 project will use a database called `sandbox.db` located in `sf_sandbox/data/`. 
     127the same table structure. 
     128 
    116129To build the table structure based on the the SQL file, type: 
    117130