Skip to content

Commit

Permalink
Merge pull request #263 from driehle/fix/doctrine-module-compatibility
Browse files Browse the repository at this point in the history
Fix compatibility issue with DoctrineModule 5.2.0
  • Loading branch information
driehle authored Oct 26, 2022
2 parents 3a0110f + 7c0974d commit c1c4fae
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"php": "^7.4 || ~8.0.0 || ~8.1.0",
"ext-mongodb": "*",
"container-interop/container-interop": "^1.2.0",
"doctrine/doctrine-module": "^5.0.0",
"doctrine/doctrine-module": "^5.0.0 <5.2.0",
"doctrine/doctrine-laminas-hydrator": "^2.2.1 || ^3.0.0",
"doctrine/event-manager": "^1.1.1",
"doctrine/mongodb-odm": "^2.3.0",
Expand Down
5 changes: 0 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,5 @@ services:
- ./docker/php.ini:/usr/local/etc/php/php.ini
depends_on:
- mongodb
environment:
- TRAVIS
- TRAVIS_JOB_ID
- TRAVIS_BRANCH
- TRAVIS_PULL_REQUEST
mongodb:
image: mongo:latest
19 changes: 10 additions & 9 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
ARG PHP_VERSION=7.2
ARG PHP_VERSION=7.4
FROM php:${PHP_VERSION}-alpine

ARG XDEBUG=0

COPY docker/entrypoint.sh /usr/local/bin/
RUN chmod 755 /usr/local/bin/entrypoint.sh

RUN apk add --no-cache \
autoconf \
Expand All @@ -18,13 +17,15 @@ RUN apk add --no-cache \
libxml2-dev \
make \
openssl-dev

RUN docker-php-ext-configure intl
RUN docker-php-ext-install -j$(nproc) intl
RUN pecl install mongodb
RUN set -o pipefail && curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN if [ ${XDEBUG} == "1" ] ; then pecl install xdebug && docker-php-ext-enable xdebug ; fi
RUN composer config --global "platform.ext-mongo" "1.6.16"

RUN chmod 755 /usr/local/bin/entrypoint.sh \
&& docker-php-ext-configure intl \
&& docker-php-ext-install -j$(nproc) intl \
&& pecl install mongodb \
&& set -o pipefail \
&& curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& if [ ${XDEBUG} == "1" ] ; then pecl install xdebug && docker-php-ext-enable xdebug ; fi \
&& composer config --global "platform.ext-mongo" "1.6.16"

WORKDIR /docker
ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]
3 changes: 2 additions & 1 deletion tests/Assets/CustomRepositoryFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Doctrine\ODM\MongoDB\DocumentManager;
use Doctrine\ODM\MongoDB\Repository\RepositoryFactory;
use Doctrine\Persistence\ObjectRepository;
use stdClass;

class CustomRepositoryFactory implements RepositoryFactory
{
Expand Down Expand Up @@ -57,7 +58,7 @@ public function findOneBy(array $criteria): ?object

public function getClassName(): string
{
return '';
return stdClass::class;
}
};
}
Expand Down
8 changes: 5 additions & 3 deletions tests/testing.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace DoctrineMongoODMModuleTest;

use Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver;

use function getenv;

return [
Expand All @@ -20,10 +22,10 @@
],
'driver' => [
'odm_default' => [
'drivers' => ['DoctrineMongoODMModuleTest\Assets\Document' => 'test'],
'drivers' => ['DoctrineMongoODMModuleTest\Assets\Document' => 'test_assets'],
],
'test' => [
'class' => 'Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver',
'test_assets' => [
'class' => AnnotationDriver::class,
'cache' => 'array',
'paths' => [__DIR__ . '/Assets/Document'],
],
Expand Down

0 comments on commit c1c4fae

Please sign in to comment.