Category: Propel

rss

PhpDebugToolbar 1.3.0 (for agavi) released

Today I am pleased to announce the new version 1.3.0 of the Agavi PHP DebugToolbar for download.

New features include full propel support (thanks tim), rows+time+memory display for the database queries and some small bugfixes.

The source can be found on github now http://github.com/DracoBlue/PhpDebugToolbar, feel free to fork it and send pull request with new features!

Download for PhpDebugToolbar 1.3.0 (just 23KB) is also available here at dracoblue.net.

Short installation and configuration information can be found in the readme. Thanks to all contributors!

UTF-8 connections with Propel in Agavi

If you want to override the propel configurations for charset (encoding) for the connection you usally set the settings['charset'] value to for example utf8.

But if you are using agavi you want to configure propel properly by using agavi's databases.xml.

So after trying a while, here is how you can set the charset (magic is bold):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?xml version="1.0" encoding="UTF-8"?>
<ae:configurations
xmlns:ae="http://agavi.org/agavi/config/global/envelope/1.0"
xmlns="http://agavi.org/agavi/config/parts/databases/1.0">
<ae:configuration>
<databases default="propel">
<database name="propel"
class="AgaviPropelDatabase">
<ae:parameter name="config">%core.app_dir%/config/propelproject-conf.php</ae:parameter>
<ae:parameter name="overrides">
<ae:parameter name="connection">
<ae:parameter name="dsn">mysql:dbname=icanhazagavirelease;host=127.0.0.1</ae:parameter>
<ae:parameter name="user">w00t</ae:parameter>
<ae:parameter name="password">not_default_pass</ae:parameter>
<ae:parameter name="settings">
<ae:parameter name="charset">
<ae:parameter name="value">utf8</ae:parameter>
</ae:parameter>
</ae:parameter>

</ae:parameter>
</ae:parameter>
</database>
</databases>
</ae:configuration>
</ae:configurations>
In open source, php, Agavi & Propel By DracoBlue @ 21:06 18.02.2009

(non)PEAR installation for Agavi and Propel

There are two ways to create an agavi project using propel.

1. Pear-Way:
1.1 Install propel:

1
2
pear install channel://pear.phpdb.org/phpdb/propel_generator
pear install channel://pear.phpdb.org/phpdb/propel_runtime

1.2 Install agavi:

1
pear install channel://pear.agavi.org/agavi-1.0.0beta8

1.3. For each project, you create a new folder and run:

1
agavi project-wizard

2. The custom way (later for deploying entire application + libs):
2.1 Create a new folder "myproject".
2.2 Create a sub folder myproject/libs and myproject/libs/propel and also myproject/libs/agavi
2.3 Download agavi's and propel's latest release* and paste the contents of the .zip/.tar.gz files in the corresponding directory.
2.4 Copy either myproject/libs/agavi/bin/agavi-dist to myproject/agavi (on linux/mac) or copy myproject/libs/agavi/bin/agavi.bat-dist to myproject/agavi.bat (on windows)
2.5 Create the project with :
a) Windows:

1
agavi project-wizard

b) Linux/Mac:

1
./agavi project-wizard

2.6. Open the agavi(.bat) file and change AGAVI_SOURCE_DIRECTORY to libs/agavi/src (or on windows libs\agavi\src)

I suggest you use the project-wizard helper only if you already know all the modules/actions you want to create. You can easily add them later with other helpers!

* Of course you can checkout also the latest svn from agavi's https://svn.agavi.org/branches/1.0 or propel's http://svn.phpdb.org/propel/trunk

In open source, php, Agavi, Propel & Tambo By DracoBlue @ 21:03 05.02.2009

retrieveByPKs undefined

Today we noticed that on some propel generated models the function retrieveByPKs was missing.

We found out that this was because of the fact that retrieveByPKs is only generated by Propel if there is only a single PrimaryKey!

In php & Propel By DracoBlue @ 13:59 04.02.2009

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?xml version="1.0" encoding="UTF-8"?>
<configurations xmlns="http://agavi.org/agavi/1.0/config">
<configuration environment="development">
<databases default="mydb">
<database name="mydb" class="AgaviPropelDatabase">
<parameter name="config">
%core.app_dir%/config/myproject-conf.php
</parameter>
<parameter name="overrides">
<parameter name="connection">
<dsn>mysql:dbname=mydb;host=localhost</dsn>
<parameter name="user">root</parameter>
<parameter name="password"></parameter>
</parameter>
</parameter>
</database>
</databases>
</configuration>
</configurations>

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

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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?xml version="1.0" encoding="UTF-8"?>
<config>
<propel>
<datasources default="mydb">
<datasource id="mydb">
<!--
this ID must match <database name="">
in schema.xml
-->
<adapter>mysql</adapter>
<!--
sqlite, mysql, myssql, oracle, or pgsql
-->

<connection>
<dsn>mysql:dbname=mydb;host=localhost</dsn>
</connection>
</datasource>
</datasources>
</propel>
</config>
In open source, php, Agavi & Propel By DracoBlue @ 18:16 09.10.2008