Skip to content
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.

odm_default adapter not recognized by ZF\Apigility\Doctrine\Admin #299

Open
jensstalder opened this issue Jul 4, 2017 · 7 comments
Open
Labels

Comments

@jensstalder
Copy link

jensstalder commented Jul 4, 2017

doctrine configuration in config/autoload/global.php

'doctrine' => array(

    'connection' => array(
        'odm_default' => array(
                  'server'           => 'mongo',
        ),
    ),

    'configuration' => array(
        'odm_default' => array(
        )
    ),

    'driver' => [
         'Application_driver' => [
            'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
            'paths' => ['module/Application/src/Document']
        ],
        'odm_default' => [
            'drivers' => [
              'Application\Document' => 'Application_driver'
            ]
        ]
    ],

    'documentmanager' => array(
        'odm_default' => array(
        )
    ),

    'eventmanager' => array(
        'odm_default' => array(
            'subscribers' => array()
        )
    ),
  ),

This configuration works outside of apigility

Result in admin

Doctrine configuration broken

Can someone point me in the right direction? Thanks.

@jensstalder
Copy link
Author

Here is the resulting config if it helps (section relevant to doctrine).

["doctrine"] => array(11) {
    ["cache"] => array(11) {
      ["apc"] => array(2) {
        ["class"] => string(30) "Doctrine\Common\Cache\ApcCache"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["apcu"] => array(2) {
        ["class"] => string(31) "Doctrine\Common\Cache\ApcuCache"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["array"] => array(2) {
        ["class"] => string(32) "Doctrine\Common\Cache\ArrayCache"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["filesystem"] => array(3) {
        ["class"] => string(37) "Doctrine\Common\Cache\FilesystemCache"
        ["directory"] => string(25) "data/DoctrineModule/cache"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["memcache"] => array(3) {
        ["class"] => string(35) "Doctrine\Common\Cache\MemcacheCache"
        ["instance"] => string(17) "my_memcache_alias"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["memcached"] => array(3) {
        ["class"] => string(36) "Doctrine\Common\Cache\MemcachedCache"
        ["instance"] => string(18) "my_memcached_alias"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["predis"] => array(3) {
        ["class"] => string(33) "Doctrine\Common\Cache\PredisCache"
        ["instance"] => string(15) "my_predis_alias"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["redis"] => array(3) {
        ["class"] => string(32) "Doctrine\Common\Cache\RedisCache"
        ["instance"] => string(14) "my_redis_alias"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["wincache"] => array(2) {
        ["class"] => string(35) "Doctrine\Common\Cache\WinCacheCache"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["xcache"] => array(2) {
        ["class"] => string(33) "Doctrine\Common\Cache\XcacheCache"
        ["namespace"] => string(14) "DoctrineModule"
      }
      ["zenddata"] => array(2) {
        ["class"] => string(35) "Doctrine\Common\Cache\ZendDataCache"
        ["namespace"] => string(14) "DoctrineModule"
      }
    }
    ["authentication"] => array(2) {
      ["odm_default"] => array(4) {
        ["objectManager"] => string(36) "doctrine.documentmanager.odm_default"
        ["identityClass"] => string(22) "Application\Model\User"
        ["identityProperty"] => string(8) "username"
        ["credentialProperty"] => string(8) "password"
      }
      ["orm_default"] => array(0) {
      }
    }
    ["authenticationadapter"] => array(2) {
      ["odm_default"] => bool(true)
      ["orm_default"] => bool(true)
    }
    ["authenticationstorage"] => array(2) {
      ["odm_default"] => bool(true)
      ["orm_default"] => bool(true)
    }
    ["authenticationservice"] => array(2) {
      ["odm_default"] => bool(true)
      ["orm_default"] => bool(true)
    }
    ["connection"] => array(1) {
      ["odm_default"] => array(7) {
        ["server"] => string(5) "mongo"
        ["port"] => string(5) "27017"
        ["connectionString"] => NULL
        ["user"] => NULL
        ["password"] => NULL
        ["dbname"] => NULL
        ["options"] => array(0) {
        }
      }
    }
    ["configuration"] => array(1) {
      ["odm_default"] => array(11) {
        ["metadata_cache"] => string(5) "array"
        ["driver"] => string(11) "odm_default"
        ["generate_proxies"] => bool(true)
        ["proxy_dir"] => string(33) "data/DoctrineMongoODMModule/Proxy"
        ["proxy_namespace"] => string(28) "DoctrineMongoODMModule\Proxy"
        ["generate_hydrators"] => bool(true)
        ["hydrator_dir"] => string(36) "data/DoctrineMongoODMModule/Hydrator"
        ["hydrator_namespace"] => string(31) "DoctrineMongoODMModule\Hydrator"
        ["default_db"] => NULL
        ["filters"] => array(0) {
        }
        ["types"] => array(0) {
        }
      }
    }
    ["driver"] => array(2) {
      ["odm_default"] => array(2) {
        ["class"] => string(61) "Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain"
        ["drivers"] => array(1) {
          ["Application\Document"] => string(18) "Application_driver"
        }
      }
      ["Application_driver"] => array(2) {
        ["class"] => string(52) "Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver"
        ["paths"] => array(1) {
          [0] => string(31) "module/Application/src/Document"
        }
      }
    }
    ["documentmanager"] => array(1) {
      ["odm_default"] => array(3) {
        ["connection"] => string(11) "odm_default"
        ["configuration"] => string(11) "odm_default"
        ["eventmanager"] => string(11) "odm_default"
      }
    }
    ["eventmanager"] => array(1) {
      ["odm_default"] => array(1) {
        ["subscribers"] => array(0) {
        }
      }
    }
    ["mongo_logger_collector"] => array(1) {
      ["odm_default"] => array(0) {
      }
    }
  }
  ["doctrine_factories"] => array(6) {
    ["cache"] => string(35) "DoctrineModule\Service\CacheFactory"
    ["eventmanager"] => string(42) "DoctrineModule\Service\EventManagerFactory"
    ["driver"] => string(36) "DoctrineModule\Service\DriverFactory"
    ["authenticationadapter"] => string(52) "DoctrineModule\Service\Authentication\AdapterFactory"
    ["authenticationstorage"] => string(52) "DoctrineModule\Service\Authentication\StorageFactory"
    ["authenticationservice"] => string(66) "DoctrineModule\Service\Authentication\AuthenticationServiceFactory"
  }

@bertrandgauthier
Copy link

Hi @jensstalder,
Did you find a solution to your problem ? Because i think i have the same.
Thank you.

@michalbundyra
Copy link
Member

@jensstalder @bertrandgauthier
I've checked it and it looks like the odm connection is not configured properly.
We should have set either connectionString or dbname, see:

https://github.com/zfcampus/zf-apigility-admin/blob/7b0bff4088afe6b117d2b536d8039796a8bb8b79/src/Model/DoctrineAdapterModel.php#L148-L154

(in doctrine => connection => odm_default array in config).

Let me know if it helps.

@bertrandgauthier
Copy link

Hi,
Sorry, it was not the same issue!
I solved my problem.
Thanks anyway.

@michalbundyra
Copy link
Member

@bertrandgauthier can you share you solution, please? Maybe it will be helpful for someone else.

@bertrandgauthier
Copy link

@webimpress
'driver_class' as key in 'connection' => 'orm_default' is no more accepted, i had to write 'driverClass' instead. I spent 2 hours to see that!

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas-api-tools/api-tools-doctrine; a new issue has been opened at laminas-api-tools/api-tools-doctrine#5.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants