Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
weierophinney opened this issue Dec 31, 2019 · 6 comments
Open
Labels
Question Further information is requested

Comments

@weierophinney
Copy link
Contributor

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.


Originally posted by @jensstalder at zfcampus/zf-apigility-doctrine#299

@weierophinney weierophinney added the Question Further information is requested label Dec 31, 2019
@weierophinney
Copy link
Contributor 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"
  }

Originally posted by @jensstalder at zfcampus/zf-apigility-doctrine#299 (comment)

@weierophinney
Copy link
Contributor Author

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


Originally posted by @bertrandgauthier at zfcampus/zf-apigility-doctrine#299 (comment)

@weierophinney
Copy link
Contributor Author

@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.


Originally posted by @michalbundyra at zfcampus/zf-apigility-doctrine#299 (comment)

@weierophinney
Copy link
Contributor Author

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


Originally posted by @bertrandgauthier at zfcampus/zf-apigility-doctrine#299 (comment)

@weierophinney
Copy link
Contributor Author

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


Originally posted by @michalbundyra at zfcampus/zf-apigility-doctrine#299 (comment)

@weierophinney
Copy link
Contributor Author

@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!


Originally posted by @bertrandgauthier at zfcampus/zf-apigility-doctrine#299 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Question Further information is requested
Projects
None yet
Development

No branches or pull requests

1 participant