No adapter found for Model_DbTable_Bureaux

14 views
Skip to first unread message

Belgacem

unread,
Apr 4, 2011, 9:06:38 AM4/4/11
to Zend Framework Developers
hello for all Zend developpers;
i need some help plz,
i have folow the zend tutoriels in this link (http://www.dator.fr/la-
serie-de-tutoriaux-sur-la-creation-dune-application-avec-le-zend-
framework/)
in the 3rd part : i have a problem and i can't find the source:
i have :
--Application
--------Bootstrap.php
--------configs
----------------application.ini
--------models
----------------DbTable
----------------------Bureaux.php
--------modules
---------------frontend
----------------------controllers
------------------------------IndexController.php
----------------------views
-----------------------------scripts
------------------------------------index
------------------------------------------index.phtml
--------views
--library
--public
---------index.php


in index.php file (located in public folder i have)
//*******************
<?php
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../
application'));

defined('LIBRARY_PATH')
|| define('LIBRARY_PATH', realpath(dirname(__FILE__) . '/../
library'));

defined('ZEND_PATH')
|| define('ZEND_PATH', realpath(dirname(__FILE__) . '/../
library'));

defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ?
getenv('APPLICATION_ENV') : 'production'));

// On modifie l'include path de PHP
set_include_path(implode(PATH_SEPARATOR, array(
realpath(ZEND_PATH),
get_include_path(),
)));

// On a besoin de Zend Application pour lancer notre application
require_once 'Zend/Application.php';
// On lance la session
require_once 'Zend/Session.php';
Zend_Session::start();

// On créé l'application, on lance le bootstrap et on lance
l'application !
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
//**********************

in Bootstrap.php file (located in application folder i have)
//*******************
<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
public function run()
{
// Cela permet d'avoir la configuration disponible de partout
dans notre application
Zend_Registry::set('config', new Zend_Config($this-
>getOptions()));
parent::run();
}

protected function _initAutoload()
{
// On enregistre les modules (les parties de notre
application), souvenez-vous : Backend et Frontend
$loader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));

return $loader;
}

protected function _initSession()
{
// On initialise la session
$session = new Zend_Session_Namespace('watchmydesk',
true);
return $session;
}

protected function _initView()
{
// Initialisation de la vue et des helpers de vue
$view = new Zend_View();
$view->doctype('XHTML1_STRICT');
// On ajoute le dossier des helpers
$view->addHelperPath(APPLICATION_PATH . '/views/helpers');
// On charge l'helper qui va se charger de la
vue
$viewRenderer =
Zend_Controller_Action_HelperBroker::getStaticHelper('ViewRenderer');
$viewRenderer->setView($view);

return $view;
}

}
//******************

application\modules\frontend\controllers\IndexController.php
//*******************
<?php
class IndexController extends Zend_Controller_Action {
public function indexAction(){
$bureaux = new Model_DbTable_Bureaux();
var_dump($bureaux->fetchAll());

}
}
//******************

Randell

unread,
Apr 4, 2011, 9:06:07 PM4/4/11
to zfdeve...@googlegroups.com
What's your problem exactly?


--
You received this message because you are subscribed to the Google Groups "Zend Framework Developers" group.
To post to this group, send email to zfdeve...@googlegroups.com.
To unsubscribe from this group, send email to zfdevelopers...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/zfdevelopers?hl=en.


Dennis

unread,
Apr 5, 2011, 7:15:23 AM4/5/11
to Zend Framework Developers
Hi, try adding this to your Bootstrap:

protected function _initAppAutoloader()
{
require_once 'Zend/Loader/Autoloader.php';
$autoloader = Zend_Loader_Autoloader::getInstance();

$loader = new Zend_Loader_Autoloader_Resource(array(
'basePath' => APPLICATION_PATH,
'namespace' => ''
));

$loader->addResourceType('model', 'models', 'Model')
->addResourceType('form', 'forms', 'Form');
}

For more information see: http://framework.zend.com/manual/1.11/en/learning.autoloading.resources.html

Belgacem

unread,
Apr 5, 2011, 4:55:43 AM4/5/11
to Zend Framework Developers
any help plz ??
Reply all
Reply to author
Forward
0 new messages