Hello David,

Could you tell me why the Propel connection has been automatically chosen ?


I removed  the "propelom" database definition the database.xml : 


The issue is fixes. Thanks a lot !

Xavier.


----- Mail original -----
De : David Zülke <[email protected]>
À : Agavi Users Mailing List <[email protected]>
Cc : 
Envoyé le : Mercredi 11 Janvier 2012 12h09
Objet : Re: [Agavi-Users] failed to open stream in AgaviPropelDatabase

I'm assuming you want to use a PDO connection, and not a Propel connection as 
well.

In that case, simply remove the "propelom" database definition from 
databases.xml. It is trying to load the given "config" file (project-conf.php) 
on startup, but you're apparently not using Propel, so that <database> 
shouldn't even be there.

David

P.S. $this->getContext()->getDatabaseConnection('pdo_mysql_main') is shorter, 
and since "pdo_mysql_main" is your default connection, 
$this->getContext()->getDatabaseConnection() will work too.



On 11.01.2012, at 11:38, Xavier O wrote:

> Hi,
> 
> I am a new Agavi user. I just followed the tutorial : 
> http://www.agavi.org/documentation/tutorial/step5/the-database-manager.html
> 
> 
> I set up the file /app/config/database.xml to create a database connexion :
> <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="pdo_mysql_main">
> 
>             <database name="pdo_mysql_main" class="AgaviPdoDatabase">
>                 <ae:parameter 
>name="dsn">mysql:host=localhost;dbname=benchmark</ae:parameter>
>                 <ae:parameter name="username">root</ae:parameter>
>                 <ae:parameter name="password">root</ae:parameter>
>             </database>
> 
>             <database name="propelom" class="AgaviPropelDatabase">
>                 <ae:parameter 
>name="config">%core.app_dir%/config/project-conf.php</ae:parameter>
>             </database>
> 
>         </databases>
>     </ae:configuration>
> </ae:configurations>
> 
> I set up /app/config/settings.xml as follow : 
> 
>         <settings>
>             <setting name="app_name">Benchmark Agavi</setting>
> 
>             <setting name="available">true</setting>
>             <setting name="debug">false</setting>
> 
>             <setting name="use_database">true</setting>
>             <setting name="use_logging">false</setting>
>             <setting name="use_security">true</setting>
>             <setting name="use_translation">false</setting>
>         </settings>
> 
> 
> I my model file, i open an new database connexion to request the database
> 
> class Sii_PopulationManagerModel extends benchmark_agaviSiiBaseModel
> {
>     public function retrieveAll() {
>         $sql = 'SELECT idPopulation, effectif, anneeNaissance 
>         FROM population p
>         ORDER BY anneeNaissance';
> 
>         $stmt = 
>$this->getContext()->getDatabaseManager()->getDatabase('pdo_mysql_main')->getConnection()->prepare($sql);
>         $stmt->execute();  
>         $populationsRowSet = $stmt->fetch(PDO::FETCH_ASSOC);
> ...
>     }
> 
> }
> 
> 
> When I open the web page, I get this message : 
> 
> Warning: 
> require(/home/ebp/share/benchmark-agavi/app/config/project-conf.php): failed 
> to open stream: No such file or directory in 
> /home/ebp/share/benchmark-agavi/libs/agavi/database/AgaviPropelDatabase.class.php
>  on line 172 Call Stack: 0.0009     315988   1. {main}() 
> /home/ebp/share/benchmark-agavi/pub/index.php:0 4.6446    1284144   2. 
> AgaviContext::getInstance() /home/ebp/share/benchmark-agavi/pub/index.php:23 
> 4.6447    1285544   3. AgaviContext->initialize() 
> /home/ebp/share/benchmark-agavi/libs/agavi/core/AgaviContext.class.php:274 
> 4.9455    1616572   4. 
> include('/home/ebp/share/benchmark-agavi/app/cache/config/factories.xml_development_web_69aae32eef99ca40bf7c9c316e9a218b6ceac608.php')
>  /home/ebp/share/benchmark-agavi/libs/agavi/core/AgaviContext.class.php:307 
> 4.9456    1621884   5. AgaviDatabaseManager->initialize()
 
/home/ebp/share/benchmark-agavi/app/cache/config/factories.xml_development_web_69aae32eef99ca40bf7c9c316e9a218b6ceac608.php:53
 5.1733  
>  1634324   6. 
>require('/home/ebp/share/benchmark-agavi/app/cache/config/databases.xml_development__dcf4b4d340933ac9a4058757038e9dd9b7c094a6.php')
> 
>/home/ebp/share/benchmark-agavi/libs/agavi/database/AgaviDatabaseManager.class.php:142
> 5.1829    1706944   7. AgaviPropelDatabase->initialize() 
>/home/ebp/share/benchmark-agavi/app/cache/config/databases.xml_development__dcf4b4d340933ac9a4058757038e9dd9b7c094a6.php:19
> Fatal error: require(): Failed opening required 
>'/home/ebp/share/benchmark-agavi/app/config/project-conf.php' 
>(include_path='.:/usr/share/php') in 
>/home/ebp/share/benchmark-agavi/libs/agavi/database/AgaviPropelDatabase.class.php
> on line 172 Call Stack: 0.0009     315988   1. {main}() 
>/home/ebp/share/benchmark-agavi/pub/index.php:0 4.6446    1284144   2. 
>AgaviContext::getInstance() /home/ebp/share/benchmark-agavi/pub/index.php:23 
>4.6447    1285544   3. AgaviContext->initialize()
> /home/ebp/share/benchmark-agavi/libs/agavi/core/AgaviContext.class.php:274 
> 4.9455    1616572   4. 
> include('/home/ebp/share/benchmark-agavi/app/cache/config/factories.xml_development_web_69aae32eef99ca40bf7c9c316e9a218b6ceac608.php')
>  /home/ebp/share/benchmark-agavi/libs/agavi/core/AgaviContext.class.php:307 
> 4.9456    1621884   5. AgaviDatabaseManager->initialize() 
> /home/ebp/share/benchmark-agavi/app/cache/config/factories.xml_development_web_69aae32eef99ca40bf7c9c316e9a218b6ceac608.php:53
>  5.1733    1634324   6. 
> require('/home/ebp/share/benchmark-agavi/app/cache/config/databases.xml_development__dcf4b4d340933ac9a4058757038e9dd9b7c094a6.php')
>  
> /home/ebp/share/benchmark-agavi/libs/agavi/database/AgaviDatabaseManager.class.php:142
> 5.1829    1706944   7. AgaviPropelDatabase->initialize() 
> /home/ebp/share/benchmark-agavi/app/cache/config/databases.xml_development__dcf4b4d340933ac9a4058757038e9dd9b7c094a6.php:19
>  
> 
> Can somebody tell me why I get this message ? How to fix it ?
> 
> Best regards,
> 
> Xavier                                                              
> 
> _______________________________________________
> users mailing list
> [email protected]
> http://lists.agavi.org/mailman/listinfo/users
> 


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users


_______________________________________________
users mailing list
[email protected]
http://lists.agavi.org/mailman/listinfo/users

Reply via email to