• Jetzt anmelden. Es dauert nur 2 Minuten und ist kostenlos!

ZendFramwork models benutzen

wolf360

Neues Mitglied
Hi,

ich bin grad dabei bei meiner Homepage das Zend Framework zu benutzen, klappt auch langsam aber sicher alles, blos das mit den Models nicht.

ich hab auch schon ewig gegoogelt aber irgendwie nichts gefundn was mir hilft....

wo bzw was muss ich machn damit ich Models beutzen kann also ($test = new Model();)

danke schon mal für die hilfe

gruß wolf360
 
es kommt die Meldung Class not found....

hier mal der auszug aus meiner application.ini
Code:
[production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts"
resources.view[] =
resources.modules[] = default, categories;
resources.db.adapter = "pdo_mysql"
resources.db.params.host = "db1610.1und1.de"
resources.db.params.username = "XXXX"
resources.db.params.password = "XXXX"
resources.db.params.dbname = "XXXX"

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1


[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
index.php
Code:
<?php
// Define path to application directory
defined('APPLICATION_PATH')
    || define('APPLICATION_PATH',
              realpath(dirname(__FILE__) . '/application'));

// Define application environment
defined('APPLICATION_ENV')
    || define('APPLICATION_ENV',
              (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV')
                                         : 'production'));

set_include_path(implode(PATH_SEPARATOR, array(
    dirname(dirname(__FILE__)) . '/library',
    get_include_path(),
)));

/** Zend_Application */

require_once 'Zend/Application.php';


// Create application, bootstrap, and run
$application = new Zend_Application(
    APPLICATION_ENV,
    APPLICATION_PATH . '/configs/application.ini'
);

$config = new Zend_Config_Ini('config/routes.ini', 'routes');
$router = new Zend_Controller_Router_Rewrite();
$router->addConfig($config, 'route');
und meine bootstrap is noch leer
 
Zuletzt bearbeitet:
Du musst gleich sagen, dass du Module benutzt.

Du wirst jetzt sicher deine Models den Modulen zuordnen, dazu musst du in jedem Modul-Ordner eine Bootstrap.php anlegen die folgendermaßen aussieht:
PHP:
<?php
class ModuleName_Bootstrap extends Zend_Application_Module_Bootstrap
{
    protected function _initAutoload()
    {
        $loader = new Zend_Application_Module_Autoloader(array(
            'namespace' => 'ModuleName_',
            'basePath'  => dirname(__FILE__),
        ));
    }
}
Für das Default-Modul habe ich die allgemeine Bootstrap, welche von Zend_Application_Bootstrap_Bootstrap erbt. Ich weiß ehrlich gesagt selbst nicht, ob das alles so richtig ist, denn ich glaube z.B. ist so keine Modul-Übergreifende Nutzung der Models möglich, was trotzdem sinnvoll ist.
 
@wolf360: Wenn du ein bessere Lösung findest, dann sag bitte Bescheid. Ich bin z.Z. wieder dran. Jetzt habe ich in meiner Bootstrap eine _initAutoloader, wo ich nach den Controllern gucke, diese Loope und einen neue Zend_Application_Module_Autoloader erzeuge und zum eigentlich Autoloader hinzufüge. Leider gehen deswegen keine Modul-Bootstraps mehr.

Kurz: ich bin damit selbst noch überfordert. In Zend < 1.8 war alles prima.
 
jo des is auch mein problem ich finde nur tutorials und anleitungen zu vorherigen versionen.... aber wenn ich was finden sollte sag ich bescheid!
 
Zurück
Oben