[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [jfw] Joomla PDO Database Driver

On Sunday, April 6, 2014 8:16:40 PM UTC+2, Herman Peeren wrote:
Just a small remark, I hope you don't mind: in your DoctrineServiceProvider line 159:
$tablePrefix = new Doctrine\TablePrefix($prefix);

As this is happening in the joomContrib\Providers namespace
Doctrine\TablePrefix is resolved to joomContrib\Providers\Doctrine\TablePrefix

Provider works fine, I'm just having problems with exporting the Table structure back to schema definition.

Anyway we should probably start a new topic.

However,  there is no TablePrefix class in the Doctrine namespace. You'll have to define that yourself. Examples like in the Doctrine cookbook define such a TablePrefix class as an event-listener. Just as with Joomla CMS plugins you use the function name to communicate on what event you want to have the function triggered. Here: loadClassMetadata ( ).
You added that event and the listener correctly to Doctrine's EventManager:
$evm->addEventListener(\Doctrine\ORM\Events::loadClassMetadata, $tablePrefix);
but you also have to provide that TablePrefix class, = the listener class, yourself. See what I wrote some postings ago.

I just wondered: didn't you get an error that that TablePrefix class was not found? Or did you add it to the Doctrine namespace yourself? AFAIK normally there is nothing in there:all Doctrine's classes are in subnamspaces Doctrine\ORM, Doctrine DBAL and Doctrine\Common.

On Sunday, 6 April 2014 19:03:25 UTC+2, piotr_cz wrote:
I didn't know that I should use the PDO versions for DBAL connection, so I just passed the same as I have configured for Joomla\DatabaseDriver, it worked and I moved along :)

However, options are limited: https://github.com/doctrine/dbal/tree/master/lib/Doctrine/DBAL/Driver so using sqlite would work for Joomla DatabaseDriver, but DBAL probaly requires pdo-sqlite so I guess I should create separate branch in configuration just for doctrine ('system.doctrine.driver').

BTW: for simple tasks (listing application extensions) I'm thinking about using generic PDO trough PdoServiceProvider , so folks don't have to require either Joomla\Database nor Doctrine.

Framework source code: https://github.com/joomla/joomla-framework
Visit http://developer.joomla.org for more information about developing with Joomla!
You received this message because you are subscribed to the Google Groups "Joomla! Framework Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-framework+unsubscribe AT googlegroups.com.
Visit this group at http://groups.google.com/group/joomla-dev-framework.