dracoblue.net

Agavi database overrides for Propel + MySQL (other databases)

Once you generated your myproject-conf.php and myproject-classmap.php, you'll notice and copy and paste them into your app/config-folder you'll maybe want to set user and password for a specific AgaviPropelDatabase.

<?xml version="1.0" encoding="UTF-8"?>
    &lt;configurations xmlns="http://agavi.org/agavi/1.0/config">
    &lt;configuration environment="development">
        &lt;databases default="[strong]mydb[/strong]">
        &lt;database name="[strong]mydb[/strong]" class="AgaviPropelDatabase">
        &lt;parameter name="config">
            %core.app_dir%/config/[strong]myproject[/strong]-conf.php
        &lt;/parameter>
        &lt;parameter name="overrides">
        &lt;parameter name="connection">
        &lt;dsn>mysql:dbname=[strong]mydb[/strong];host=[strong]localhost[/strong]&lt;/dsn>
        &lt;parameter name="user">root&lt;/parameter>
        &lt;parameter name="password">&lt;/parameter>
        &lt;/parameter>
        &lt;/parameter>
        &lt;/database>
        &lt;/databases>
    &lt;/configuration>
&lt;/configurations>

Here you also can change the dns-entry to match different sql servers!

Your runtime-conf.xml for propel looks like that:

<?xml version="1.0" encoding="UTF-8"?>
&lt;config>
    &lt;propel>
        &lt;datasources default="[strong]mydb[/strong]">
            &lt;datasource id="[strong]mydb[/strong]">


<!-- 
                    this ID must match <database name="">
                    in schema.xml
                -->
                &lt;adapter>mysql&lt;/adapter> 


<!--
                        sqlite, mysql, myssql, oracle, or pgsql
                    -->

                &lt;connection>
                    &lt;dsn>mysql:dbname=[strong]mydb[/strong];host=localhost&lt;/dsn>
                &lt;/connection>
            &lt;/datasource>
        &lt;/datasources>
    &lt;/propel>
&lt;/config>

In agavi, open source, php, propel by @ 09 Oct 2008

comments powered by Disqus

Recent Files

Advertisement

Recent Dev-Articles

Read recently

About

Blogroll