Hello

How can I use my Propel models without Symfony?

The reason: I already have a project with some console-only scripts
from years ago that use plain PDO. Then I wrote a web "admin frontend"
with Symfony 1.3 and got addicted to Propel 1.5 (via sfPropel15Plugin)
and already customized some model classes.

Now I want to slowly merge the two code bases and would like to start
by using the Propel models inside one of the legacy PHP scripts.

Sadly the sfPropel15Plugin does not offer the "propel-gen convert-conf"
so my first approach was something like:

  <?php
  spl_autoload_register(array('myToolkit', 'autoload'));
        
  Propel::setConfiguration(array(/* config incl. credentials */);
  Propel::initialize();

  $numRows = CustomerQuery::create()->count();

Obviously it would be more elegant if I could use the Symfony
config/database.yml to avoid storing credentials redundantly.

Should I use an yml parser, fetch the wanted environment and then convert
it to a Propel style config array and write it to a file? Or can I
somehow use the Symfony ProjectConfiguration? Or is there an easy way
to add a "convert-conf" to the sfPropel15Plugin?

bye,

-christian-

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to