[symfony-users] Re: Using DB model in a pake task

2007-08-22 Thread Olivier Revollat
Thanks, a lot... that's what I found in the source code of the
propel_load_data task ;)

But, when I try this :

pake_desc('Tirage au sort des gagnants du jeux Trafic FM');
pake_task('tirage','app_exists');
function run_tirage($task, $args)
{
  $app= $args[0];
  $databaseManager = new sfDatabaseManager();
  $databaseManager-initialize();
}

I get the following error :


[sfConfigurationException]

  Module directory C:\xampp\htdocs\escota\symfony_private\apps\\modules
does not exist or is not readable
:(

Any idea ? thanks... ;)


2007/8/22, Fabien POTENCIER [EMAIL PROTECTED]:


 To initialize database connections:

 $databaseManager = new sfDatabaseManager();
 $databaseManager-initialize();

 Optionally, you can retrieve the current database connection:

 $con = Propel::getConnection();

 Fabien

 Olivier Revollat wrote:
  How can I use my propel model inside a pake task ?
 
  I've try to write something like this (see below) but I get the
  following error :
 
[PropelException]
No connection params set for propel
 
  What should I call inside the task to be able to use my model and
  request the database ?
  Any ideas ?? thanks ...
 
 
  pake_desc('Tirage au sort des gagnants du jeux Trafic FM');
  pake_task('tirage');
 
  function run_tirage($task, $args)
  {
  $jeu = new Jeux();
  $nbjeux = $jeu-getOnlineJeux();
  $nbjeux-next();
  $nbjeux = $nbjeux-getInt('nbjeux');
  if($nbjeux=1)
  {
  pake_echo('OK');
  }
  }
 
 
  

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Using DB model in a pake task

2007-08-22 Thread Olivier Revollat
The problem seem to come from sfConfig::get when retriving applicatio module
directory :

When I try this :

pake_task('tirage','app_exists');
function run_tirage($task, $args)
{
  $app= $args[0];
  pake_echo(sfConfig::get('sf_app_module_dir'));
}

I call ./symfony tirage admin
sfConfig returns :

C:\[...]\symfony_private\apps\\modules
instead of :
C:\[...]\symfony_private\apps\admin\modules

What's wrong ? did I forget something ? did I properly define the
application ($app= $args[0];) ??

Thanks ;)


2007/8/22, Olivier Revollat [EMAIL PROTECTED]:

 Thanks, a lot... that's what I found in the source code of the
 propel_load_data task ;)

 But, when I try this :

 pake_desc('Tirage au sort des gagnants du jeux Trafic FM');
 pake_task('tirage','app_exists');
 function run_tirage($task, $args)
 {
   $app= $args[0];
   $databaseManager = new sfDatabaseManager();
   $databaseManager-initialize();
 }

 I get the following error :


 [sfConfigurationException]

   Module directory C:\xampp\htdocs\escota\symfony_private\apps\\modules
 does not exist or is not readable
 :(

 Any idea ? thanks... ;)


 2007/8/22, Fabien POTENCIER [EMAIL PROTECTED]:
 
 
  To initialize database connections:
 
  $databaseManager = new sfDatabaseManager();
  $databaseManager-initialize();
 
  Optionally, you can retrieve the current database connection:
 
  $con = Propel::getConnection();
 
  Fabien
 
  Olivier Revollat wrote:
   How can I use my propel model inside a pake task ?
  
   I've try to write something like this (see below) but I get the
   following error :
  
 [PropelException]
 No connection params set for propel
  
   What should I call inside the task to be able to use my model and
   request the database ?
   Any ideas ?? thanks ...
  
  
   pake_desc('Tirage au sort des gagnants du jeux Trafic FM');
   pake_task('tirage');
  
   function run_tirage($task, $args)
   {
   $jeu = new Jeux();
   $nbjeux = $jeu-getOnlineJeux();
   $nbjeux-next();
   $nbjeux = $nbjeux-getInt('nbjeux');
   if($nbjeux=1)
   {
   pake_echo('OK');
   }
   }
  
  
   
 
   
 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---



[symfony-users] Re: Using DB model in a pake task

2007-08-22 Thread Luciano A. Andrade

See the code from test/bootstrap/functional.php you must define
symfony constant , SF_APP, at least (i define all that are defined on
the boostrap script), then you can initialize the database connections
(probably needs the 'SF_ENVIRONMENT' constant to)

On 8/22/07, Olivier Revollat [EMAIL PROTECTED] wrote:
 The problem seem to come from sfConfig::get when retriving applicatio module
 directory :

 When I try this :

 pake_task('tirage','app_exists');
 function run_tirage($task, $args)
 {
   $app= $args[0];
   pake_echo(sfConfig::get('sf_app_module_dir'));
 }

 I call ./symfony tirage admin
 sfConfig returns :

 C:\[...]\symfony_private\apps\\modules
 instead of :
 C:\[...]\symfony_private\apps\admin\modules

 What's wrong ? did I forget something ? did I properly define the
 application ($app= $args[0];) ??

 Thanks ;)


 2007/8/22, Olivier Revollat  [EMAIL PROTECTED]:
  Thanks, a lot... that's what I found in the source code of the
 propel_load_data task ;)
 
  But, when I try this :
 
  pake_desc('Tirage au sort des gagnants du jeux Trafic FM');
  pake_task('tirage','app_exists');
  function run_tirage($task, $args)
  {
$app= $args[0];
$databaseManager = new sfDatabaseManager();
$databaseManager-initialize();
  }
 
  I get the following error :
 
[sfConfigurationException]


Module directory
 C:\xampp\htdocs\escota\symfony_private\apps\\modules does
 not exist or is not readable
  :(
 
  Any idea ? thanks... ;)
 
 
 
  2007/8/22, Fabien POTENCIER  [EMAIL PROTECTED]:
 
  
   To initialize database connections:
  
   $databaseManager = new sfDatabaseManager();
   $databaseManager-initialize();
  
   Optionally, you can retrieve the current database connection:
  
   $con = Propel::getConnection();
  
   Fabien
  
   Olivier Revollat wrote:
How can I use my propel model inside a pake task ?
   
I've try to write something like this (see below) but I get the
following error :
   
  [PropelException]
  No connection params set for propel
   
What should I call inside the task to be able to use my model and
request the database ?
Any ideas ?? thanks ...
   
   
pake_desc('Tirage au sort des gagnants du jeux Trafic FM');
pake_task('tirage');
   
function run_tirage($task, $args)
{
$jeu = new Jeux();
$nbjeux = $jeu-getOnlineJeux();
$nbjeux-next();
$nbjeux = $nbjeux-getInt('nbjeux');
if($nbjeux=1)
{
pake_echo('OK');
}
}
   
   

  
  
  
  
 
 


  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
symfony users group.
To post to this group, send email to symfony-users@googlegroups.com
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
-~--~~~~--~~--~--~---