Foros del Web » Programando para Internet » PHP » Zend »

Error qucikstar zendframework

Estas en el tema de Error qucikstar zendframework en el foro de Zend en Foros del Web. Hola buenas , estoy empezando con zend framework y en con quickstart me encuntro con el siguiente problema, respecto del tutorila , he realizado unos ...
  #1 (permalink)  
Antiguo 02/03/2010, 09:35
 
Fecha de Ingreso: agosto-2009
Mensajes: 138
Antigüedad: 14 años, 8 meses
Puntos: 0
Error qucikstar zendframework

Hola buenas , estoy empezando con zend framework y en con quickstart me encuntro con el siguiente problema, respecto del tutorila , he realizado unos cambios,como que la conexion no es a sqllite sino a mysql y la base de datos y la tabla la cree atraves de consola de mysql ...y no se como solucionar este facho.
En el php.ini tengo:
Código:
[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts/"
resources.view[] =
resources.db.adapter = "PDO_Mysql"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook.db"
resources.db.params.host = "localhost"
resources.db.params.username = "root"
resources.db.params.password = "root"
resources.db.params.dbname = "quickstart"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.db.adapter = "PDO_Mysql"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-testing.db"


[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1
resources.db.adapter = "PDO_Mysql"
resources.db.params.dbname = APPLICATION_PATH "/../data/db/guestbook-dev.db"
en el GuestbookController.php hay:
Código PHP:
class GuestbookController extends Zend_Controller_Action
{

    public function 
init()
    {
        
/* Initialize action controller here */
    
}

    public function 
indexAction()
    {
        
// action body
        
$guestbook = new Application_Model_GuestbookMapper();
        
$this->view->entries $guestbook->fetchAll();
    }



en el guestbook/index.phtml esto otro
Código:
      <!-- application/views/scripts/guestbook/index.phtml -->
      <p><a href="<?php echo $this->url(
          array(
              'controller' => 'guestbook',
              'action'     => 'sign'
          ),
          'default',
          true) ?>">Sign Our Guestbook</a></p>
       
      Guestbook Entries: <br />
      <dl>
          <?php foreach ($this->entries as $entry): ?>
          <dt><?php echo $this->escape($entry->email) ?></dt>
          <dd><?php echo $this->escape($entry->comment) ?></dd>
          <?php endforeach ?>
      </dl>
en el layout/layout.phtml esto:


models/guestbook
Código PHP:
class Application_Model_Guestbook
{

    protected 
$_comment;
    protected 
$_created;
    protected 
$_email;
    protected 
$_id;
    

    public function 
__construct(array $options null)
    {
        if (
is_array($options)) {
            
$this->setOptions($options);
        }
    }
 
    public function 
__set($name$value)
    {

        
$method 'set' $name;
        if ((
'mapper' == $name) || !method_exists($this$method)) {
            throw new 
Exception('Invalid guestbook property');
        }
        
$this->$method($value);
    }
    public function 
__get($name)
    {

        
$method 'get' $name;
        if ((
'mapper' == $name) || !method_exists($this$method)) {
            throw new 
Exception('Invalid guestbook property');
        }
        return 
$this->$method();
    }
    public function 
setOptions(array  $options)
    {
        
$methods get_class_methods($this);
        foreach (
$options as $key => $value) {
            
$method 'set' ucfirst($key);
            if (
in_array($method$methods)) {
                
$this->$method($value);
            }
        }
        return 
$this;
    }
    public function 
setComment($text)
    {
    
        
$this->_comment = (string) $text;
        return 
$this;
    }
    public function 
getComment()
    {
        return 
$this->_comment;
    }
    public function 
setEmail($email)
    {
        
$this->_email = (string) $email;
        return 
$this;
    }
    public function 
getEmail()
    {
        return 
$this->_email;
    }
    public function 
setCreated($ts)
    {
        
$this->_created = (string) $ts;
        return 
$this;
    }
    public function 
getCreated()
    {
        return 
$this->_created;;
    }
    public function 
setId($id)
    {
        
        
$this->_id = (int) $id;
        return 
$this;
    }
    public function 
getId()
    {
        return 
$this->_id;
    }

models/guestbookmapper

Código PHP:
<?php

class Application_Model_GuestbookMapper
{
    protected 
$_dbTable;
    
    public function 
setDbTable($dbTable)
    {
        if (
is_string($dbTable)) {
            
$dbTable = new $dbTable();
        }
        
        if (!
$dbTable instanceof Zend_Db_Table_Abstract) {
            throw new 
Exception('Invalid table data gateway provided');
        }
        
$this->_dbTable $dbTable;
        return 
$this;
    }
        
    public function 
getDbTable()
    {
        if (
null === $this->_dbTable) {
            
$this->setDbTable('Application_Model_DbTable_Guestbook');
        }
        return 
$this->_dbTable;
    }
    public function 
save(Application_Model_Guestbook $guestbook)
    {
    
        
$data = array(
            
'email'   => $guestbook->getEmail(),
            
'comment' => $guestbook->getComment(),
            
'created' => $guestbook->getDate(),);

        if (
null === ($id $guestbook->getId())) {
            unset(
$data['id']);
            
$this->getDbTable()->insert($data);
        } else {
            
$this->getDbTable()->update($data, array('id = ?' => $id));
        }
    }
    public function 
find($id,Application_Model_Guestbook $guestbook)
    {

        
$result $this->getDbTable()->find($id);
        if (
== count($result)) {
            return;
        }
        
$row $result->current();
        
$guestbook->setId($row->id)
                  ->
setEmail($row->email)
                  ->
setComment($row->comment)
                  ->
setCreated($row->created);
    }
    public function 
fetchAll()
    {

        
$resultSet $this->getDbTable()->fetchAll();
        
$entries   = array();
        foreach (
$resultSet as $row) {
            
$entry = new Application_Model_Guestbook();
            
$entry->setId($row->id)
                  ->
setEmail($row->email)
                  ->
setComment($row->comment)
                  ->
setCreated($row->created);
            
$entries[] = $entry;
        }
        return 
$entries;
    
    }
}
El error q suelta la pagiana es:
Fatal error: Uncaught exception 'Zend_Db_Adapter_Exception' with message 'Configuration array must have a key for 'password' for login credentials' in C:\Archivos de programa\Apache Software Foundation\Apache2.2\ZendFramework\quickstart\libr ary\Zend\Db\Adapter\Abstract.php:284

y el apache es suelta este error en el log:

Uncaught exception 'Zend_Db_Adapter_Exception' with message 'Configuration array must have a key for 'password' for login credentials'

Una ayuda , me he quedado hay y no se porque , seguro que es por motivos de configuracion del adapter pero no se donde ni como solucionarlo
gracias
  #2 (permalink)  
Antiguo 02/03/2010, 10:11
Avatar de SergeMedina  
Fecha de Ingreso: septiembre-2007
Ubicación: Guadalajara, Jalisco
Mensajes: 459
Antigüedad: 16 años, 7 meses
Puntos: 20
Respuesta: Error qucikstar zendframework

Tu quieres utilizar una base de datos de MySQL? o utilizar SQLite?
__________________
I see dead pixels
  #3 (permalink)  
Antiguo 02/03/2010, 12:08
 
Fecha de Ingreso: agosto-2009
Mensajes: 138
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Error qucikstar zendframework

quiero usar mysql
  #4 (permalink)  
Antiguo 02/03/2010, 13:38
Avatar de SergeMedina  
Fecha de Ingreso: septiembre-2007
Ubicación: Guadalajara, Jalisco
Mensajes: 459
Antigüedad: 16 años, 7 meses
Puntos: 20
Respuesta: Error qucikstar zendframework

Ok primero: dbname en todas las partes del archivo de configuracion debe de ser el nombre de una base de datos y no un path, elimina los paths.

Para todas mis configuraciones de MySQL tengo esto:

Código ini:
Ver original
  1. resources.db.adapter = PDO_MYSQL
  2. resources.db.params.host = dbhost
  3. resources.db.params.dbname = dbname
  4. resources.db.params.username = dbuser
  5. resources.db.params.password = dbpass
  6. resources.db.params.charset = utf8
__________________
I see dead pixels
  #5 (permalink)  
Antiguo 03/03/2010, 03:19
 
Fecha de Ingreso: agosto-2009
Mensajes: 138
Antigüedad: 14 años, 8 meses
Puntos: 0
Respuesta: Error qucikstar zendframework

Ok todo perfecto , muchas gracias....

Podeis cerrar el post , seguire posteado...que recien empiezo con el zend framework...saludos

Última edición por niewpendejo; 03/03/2010 a las 03:29
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:37.