Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Zend Framework 2 und doctrineORMModule

Empfohlene Antworten

Veröffentlicht

Hallo,

ich wollte mir gestern einmal Zend Framework 2 installieren mit dem ORM doctrine. Das gibt es bereits als Modul für Zend 2 und nennt sich doctrineORMModule.

Funktionierte auch alles soweit, einziges problem, die aliases, die doctrine für die CLI verwendet, fehlen bei mir noch. Und ich habe leider keine Ahnung wo ich die hinschreiben soll. Ich bin mit dem Zend Framework 1 vertraut. Dort wäre es auch kein Problem gewesen, einfach in der application.ini eintragen und alles wäre wunderbar gewesen.

Ich vermute mal stark muss das jetzt in Form von Unterarrays anstatt der Punktschreibweise machen und zwar in der moudele.config.php, oder?

Meine config Dateien sehen aktuell so aus:

module.config.php:

<?php
return array(
'controllers' => array(
'invokables' => array(
'Frontpage\Controller\Frontpage' => 'Frontpage\Controller\FrontpageController',
),
),
'router' => array(
'routes' => array(
'frontpage' => array(
'type' => 'segment',
'options' => array(
'route' => '/frontpage[/][:action][/:id]',
'constraints' => array(
'action' => '[a-zA-Z][a-zA-Z0-9_-]*',
'id' => '[0-9]+',
),
'defaults' => array(
'controller' => 'Frontpage\Controller\Frontpage',
'action' => 'index',
),
),
),
),
),
'view_manager' => array(
'template_path_stack' => array(
'frontpage' => __DIR__ . '/../view',
),
),
'doctrine' => array(
'driver' => array(
'application_entities' => array(
'class' =>'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'cache' => 'array',
'paths' => array(__DIR__ . '/../src/Model')
),

'orm_default' => array(
'drivers' => array(
'Frontpage\Model' => 'frontpage_entities'
)
),
),
),
);[/PHP]

application.config.php:

[PHP]<?php
return array(
// This should be an array of module namespaces used in the application.
'modules' => array(
'Application',
'DoctrineModule',
'DoctrineORMModule',
'Frontpage',
'ZendDeveloperTools',
),

// These are various options for the listeners attached to the ModuleManager
'module_listener_options' => array(
// This should be an array of paths in which modules reside.
// If a string key is provided, the listener will consider that a module
// namespace, the value of that key the specific path to that module's
// Module class.
'module_paths' => array(
'./module',
'./vendor',
),

// An array of paths from which to glob configuration files after
// modules are loaded. These effectively override configuration
// provided by modules themselves. Paths may use GLOB_BRACE notation.
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),

// Whether or not to enable a configuration cache.
// If enabled, the merged configuration will be cached and used in
// subsequent requests.
//'config_cache_enabled' => $booleanValue,

// The key used to create the configuration cache file name.
//'config_cache_key' => $stringKey,

// Whether or not to enable a module class map cache.
// If enabled, creates a module class map cache which will be used
// by in future requests, to reduce the autoloading process.
//'module_map_cache_enabled' => $booleanValue,

// The key used to create the class map cache file name.
//'module_map_cache_key' => $stringKey,

// The path in which to cache merged configuration.
//'cache_dir' => $stringPath,

// Whether or not to enable modules dependency checking.
// Enabled by default, prevents usage of modules that depend on other modules
// that weren't loaded.
// 'check_dependencies' => true,
),

// Used to create an own service manager. May contain one or more child arrays.
//'service_listener_options' => array(
// array(
// 'service_manager' => $stringServiceManagerName,
// 'config_key' => $stringConfigKey,
// 'interface' => $stringOptionalInterface,
// 'method' => $stringRequiredMethodName,
// ),
// )

// Initial configuration with which to seed the ServiceManager.
// Should be compatible with Zend\ServiceManager\Config.
// 'service_manager' => array(),
);

doctrine.local.php:

<?php
return array(
'doctrine' => array(
'connection' => array(
'orm_default' => array(
'driverClass' =>'Doctrine\DBAL\Driver\PDOMySql\Driver',
'params' => array(
'host' => 'localhost',
'port' => '3306',
'user' => 'root',
'password' => 'geheim',
'dbname' => 'testdb',
)
)
)
)
);
?>[/PHP]

Das ganze läuft in der Testumgebung unter XAMPP mit MySQL als Datenbank.

Folgende Exceptions bekomme ich auf der Konsole:

[PHP]An exception was raised while creating "doctrine.entitymanager.orm_default"; no instance returned

natürlich für alle doctrine.XXX Variablen

Doctrine für Zend kann man hier beziehen: https://github.com/doctrine/DoctrineORMModule

Ich hoffe es versteht jemand eher, bzw. ihr könnt mir helfen.

MFG derwunner

  • Autor

Problem gelöst. Ich mach das jetzt einfach mit der PHP-Funktion class_alias im Autoloader. Sicherlich nicht der beste Weg, aber einer! ;-)

Ein Problem noch: Ich glaube mir fehlen Ordnerberechtigungen, denn is_dir gibt false zurück, auf einen Ordner, den es mit Sicherheit git. Liegt unterhalb htdocs im XAMPP Verzeichnis.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.