Skip to content

Commit

Permalink
Converted to Laminas
Browse files Browse the repository at this point in the history
  • Loading branch information
TomHAnderson committed Jul 20, 2020
1 parent 437d4d5 commit 8065c21
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 43 deletions.
22 changes: 0 additions & 22 deletions Module.php

This file was deleted.

14 changes: 6 additions & 8 deletions config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

return array(
'service_manager' => array(
'invokables' => array(
'ZF\Doctrine\Hydrator\Strategy\CollectionExtract' =>
'ZF\Doctrine\Hydrator\Strategy\CollectionExtract',
),
'factories' => array(
'ZF\Doctrine\Hydrator\Strategy\CollectionLink' =>
'ZF\Doctrine\Hydrator\Strategy\CollectionLinkFactory',
'ZF\Doctrine\Hydrator\Strategy\EntityLink' =>
'ZF\Doctrine\Hydrator\Strategy\EntityLinkFactory',
'ApiSkeletons\Doctrine\Hydrator\Strategy\CollectionExtract' =>
'Laminas\ServiceManager\Factory\InvokableFactory',
'ApiSkeletons\Doctrine\Hydrator\Strategy\CollectionLink' =>
'ApiSkeletons\Doctrine\Hydrator\Strategy\CollectionLinkFactory',
'ApiSkeletons\Doctrine\Hydrator\Strategy\EntityLink' =>
'ApiSkeletons\Doctrine\Hydrator\Strategy\EntityLinkFactory',
),
),
);
2 changes: 1 addition & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<phpunit bootstrap="./test/Bootstrap.php" colors="true">
<testsuites>
<testsuite name="hydrators">
<directory>./test/ZFTest</directory>
<directory>./test/ApiSkeletonsTest</directory>
</testsuite>
</testsuites>

Expand Down
2 changes: 1 addition & 1 deletion src/CollectionExtract.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ZF\Doctrine\Hydrator\Strategy;
namespace ApiSkeletons\Doctrine\Hydrator\Strategy;

use Laminas\Hydrator\Strategy\StrategyInterface;
use DoctrineModule\Stdlib\Hydrator\Strategy\AbstractCollectionStrategy;
Expand Down
2 changes: 1 addition & 1 deletion src/CollectionLink.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ZF\Doctrine\Hydrator\Strategy;
namespace ApiSkeletons\Doctrine\Hydrator\Strategy;

use Laminas\Hydrator\Strategy\StrategyInterface;
use Laminas\Filter\FilterChain;
Expand Down
2 changes: 1 addition & 1 deletion src/CollectionLinkFactory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ZF\Doctrine\Hydrator\Strategy;
namespace ApiSkeletons\Doctrine\Hydrator\Strategy;

use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/EntityLink.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ZF\Doctrine\Hydrator\Strategy;
namespace ApiSkeletons\Doctrine\Hydrator\Strategy;

use Laminas\Hydrator\Strategy\StrategyInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
Expand Down
2 changes: 1 addition & 1 deletion src/EntityLinkFactory.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ZF\Doctrine\Hydrator\Strategy;
namespace ApiSkeletons\Doctrine\Hydrator\Strategy;

use Laminas\ServiceManager\FactoryInterface;
use Laminas\ServiceManager\ServiceLocatorInterface;
Expand Down
11 changes: 11 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace ApiSkeletons\Doctrine\Hydrator\Strategy;

class Module
{
public function getConfig()
{
return include __DIR__ . '/../config/module.config.php';
}
}
3 changes: 1 addition & 2 deletions test/ApiSkeletonsTest/StrategyTest.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace ApiSkeleontsTest\Doctrine\Hydrator\Strategy;
namespace ApiSkeletonsTest\Doctrine\Hydrator\Strategy;

use Doctrine\Common\DataFixtures\Loader as BaseLoader;
use Doctrine\Common\DataFixtures\Executor\ORMExecutor;
Expand Down Expand Up @@ -53,7 +53,6 @@ public function testTrue()
$this->getApplication()->run();
$body = json_decode($this->getResponse()->getBody(), true);
$this->assertResponseStatusCode(200);

$this->assertEquals('Soft Cell', $body['name']);
$this->assertEquals('1', $body['id']);
$this->assertEquals('Non-Stop Erotic Cabaret', $body['_embedded']['album'][0]['name']);
Expand Down
2 changes: 1 addition & 1 deletion test/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ protected static function initAutoloader()
'Laminas\Loader\StandardAutoloader' => array(
'autoregister_zf' => true,
'namespaces' => array(
'ApiSkeletons\OAuth2\Doctrine\Permissions\Acl' => __DIR__ . '/../src/',
'ApiSkeletons\\Doctrine\\Hydrator\\Strategy' => __DIR__ . '/../src/',
__NAMESPACE__ => __DIR__,
),
),
Expand Down
2 changes: 2 additions & 0 deletions test/TestConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
'Laminas\\ApiTools\\Rest',
'Laminas\\ApiTools\\Rpc',
'Laminas\\ApiTools\\Versioning',

'DoctrineModule',
'DoctrineORMModule',
'Phpro\DoctrineHydrationModule',
'Laminas\\ApiTools\\Doctrine\\Server',

'ApiSkeletons\\Doctrine\\Hydrator\\Strategy',
'Db',
'DbApi',
Expand Down
8 changes: 8 additions & 0 deletions test/autoload/local.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?php

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

return [
'doctrine' => [
'connection' => [
Expand All @@ -11,4 +15,8 @@
],
],
],
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
],
];
8 changes: 4 additions & 4 deletions test/module/DbApi/config/module.config.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
],
],
],
'laminas-api-tools' => [
'api-tools' => [
'doctrine-connected' => [
'DbApi\\V1\\Rest\\Album\\AlbumResource' => [
'object_manager' => 'doctrine.entitymanager.orm_default',
Expand All @@ -207,8 +207,8 @@
'object_manager' => 'doctrine.entitymanager.orm_default',
'by_value' => true,
'strategies' => [
'artist' => 'ZF\Doctrine\Hydrator\Strategy\EntityLink',
'song' => 'ZF\Doctrine\Hydrator\Strategy\CollectionLink',
'artist' => 'ApiSkeletons\Doctrine\Hydrator\Strategy\EntityLink',
'song' => 'ApiSkeletons\Doctrine\Hydrator\Strategy\CollectionLink',
],
'use_generated_hydrator' => true,
],
Expand All @@ -217,7 +217,7 @@
'object_manager' => 'doctrine.entitymanager.orm_default',
'by_value' => true,
'strategies' => [
'album' => 'ZF\Doctrine\Hydrator\Strategy\CollectionExtract',
'album' => 'ApiSkeletons\Doctrine\Hydrator\Strategy\CollectionExtract',
],
'use_generated_hydrator' => true,
],
Expand Down
1 change: 1 addition & 0 deletions test/module/DbApi/src/DbApi/Module.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace DbApi;

use Laminas\ApiTools\Provider\ApiToolsProviderInterface;
Expand Down

0 comments on commit 8065c21

Please sign in to comment.