0
votes

I am trying to configure Zend 2 + doctrine 2 on azure websites. We do not have access to the command line on the windows azure websites so we cannot perform php composer.phar update to fix the doctrine modules so that zend can load them. I am getting the following error message

Zend\ServiceManager\ServiceManager::get was unable to fetch or create an instance for doctrine.entitymanager.orm_default

On my local machine I have loaded the modules in application.config.php file as

'modules' => array(
    'Rest',
'Front',
'DoctrineModule',
    'DoctrineORMModule'
),

but on azure, it is not able to load DoctrineModule and DoctrineORMModule.

Then I decided to remove the doctrine modules to load like this. and I am trying to load them as

public function getAutoloaderConfig()
{
    return array(
        'Zend\Loader\StandardAutoloader' => array(
            'namespaces' => array(
                __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
        'Doctrine\Common'   => __DIR__ . '/../../library/vendor/doctrine/common',
        'Doctrine\DBAL'     => __DIR__ . '/../../library/vendor/doctrine/dbal',
        'Symfony\Console'   => __DIR__ . '/../../library/vendor/symfony/console',
        'DoctrineModule'    => __DIR__ . '/../../library/vendor/doctrine/doctrine-module',
        'DoctrineORMModule' => __DIR__ . '/../../library/vendor/doctrine/doctrine-orm-module',
            ),
        ),
    );
}

in Module.php, but now it is not able to get doctrine.entitymanager.orm_default using ServiceManager (as indicated above). What should I do ? How should I manually load everything for doctrine modules in zend application. Please suggest.

1
If you are not using Doctrine command for some reason then you will have to manually Generate the Respected part of the code that you need. E.g those commands help you generate DB schema etc. But for your case you must parse some thing like this in Module.php file of your some module public function getServiceConfig() {return array( 'factories' => array( 'EntityManager' => function($SM) { $EM = $SM->get('doctrine.entitymanager.orm_default'); return $EM;},),);}noobie-php
For the moment try placing the code part in your Module.php file that belongs to Application Modulenoobie-php

1 Answers

0
votes

You do have access to the command-line in Windows Azure Web Sites. There are a few ways to access it:

  1. Use KuduExec (npm install kuduexec -g) from your local machine
  2. Use KuduExec (https://mywebsite.scm.azurewebsites.net) from a Web Browser
  3. Customize the Deployment using a deployment hook in Kudu

Using one of these methods you can use curl to download composer.phar, and run composer update on your project to get the dependencies installed on your web site.