Skip to content

Commit

Permalink
php 8.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gregorybesson committed Jun 9, 2022
1 parent eaabb5d commit 15c5ff3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -90,11 +90,11 @@
"laminas/laminas-view": ">=2.8",
"laminas/laminas-xml2json": ">=3.0",
"laminas/laminas-xmlrpc": ">=2.6",
"zendframework/zendxml": ">=1.0.2",
"hhxsv5/php-sse": "~2.0",
"lm-commons/lmc-cors": "^1.2",
"laminas/laminas-cli": "^1.4",
"playground/doctrine-data-fixture-module": "^1.1"
"playground/doctrine-data-fixture-module": "^1.1",
"laminas/laminas-xml": "^1.4"
},
"require-dev": {
"phpunit/phpunit": ">=4.0.0",
Expand Down
6 changes: 3 additions & 3 deletions config/module.config.php
Expand Up @@ -33,9 +33,9 @@
'doctrine' => array(
'driver' => array(
'playgroundcore_entity' => array(
'class' => 'Doctrine\ORM\Mapping\Driver\AnnotationDriver',
'class' => \Doctrine\ORM\Mapping\Driver\AnnotationDriver::class,
'cache' => 'array',
'paths' => __DIR__ . '/../src/Entity'
'paths' => [__DIR__ . '/../src/Entity']
),

'orm_default' => array(
Expand All @@ -47,7 +47,7 @@
'connection' => array(
// default connection name
'orm_default' => array(
'driverClass' => 'Doctrine\DBAL\Driver\PDOMySql\Driver',
'driverClass' => \Doctrine\DBAL\Driver\PDO\MySQL\Driver::class,
'params' => array(
'host' => '127.0.0.1',
'port' => '3306',
Expand Down
2 changes: 1 addition & 1 deletion src/Controller/Admin/WebsiteController.php
Expand Up @@ -45,7 +45,7 @@ public function indexAction()
public function listAction()
{
$locales = $this->getLocaleService()->getLocaleMapper()->findBy(array('active_front' => 1));
$user = $this->zfcUserAuthentication()->getIdentity();
$user = $this->lmcUserAuthentication()->getIdentity();

$websites = $this->getWebsiteService()->getWebsiteMapper()->findAll();

Expand Down
8 changes: 4 additions & 4 deletions src/Stdlib/Hydrator/DoctrineObject.php
Expand Up @@ -3,7 +3,7 @@
namespace PlaygroundCore\Stdlib\Hydrator;

use DateTime;
use Doctrine\Common\Persistence\ObjectManager;
use Doctrine\Persistence\ObjectManager;

/**
*
Expand All @@ -12,7 +12,7 @@
* having to fix a DoctrineModule bug :( https://github.com/doctrine/DoctrineModule/issues/180
* so i've extended DoctrineHydrator ...
*/
class DoctrineObject extends \DoctrineModule\Stdlib\Hydrator\DoctrineObject
class DoctrineObject extends \Doctrine\Laminas\Hydrator\DoctrineObject
{

/**
Expand All @@ -22,9 +22,9 @@ class DoctrineObject extends \DoctrineModule\Stdlib\Hydrator\DoctrineObject
* @param string $targetClass The FQCN of the hydrated/extracted object
* @param bool $byValue If set to true, hydrator will always use entity's public API
*/
public function __construct(ObjectManager $objectManager, $targetClass, $byValue = true)
public function __construct(ObjectManager $objectManager, bool $byValue = true, ?Inflector $inflector = null)
{
parent::__construct($objectManager, $targetClass, $byValue);
parent::__construct($objectManager, $byValue, $inflector);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions src/Stdlib/Hydrator/Strategy/ObjectStrategy.php
Expand Up @@ -2,12 +2,13 @@
namespace PlaygroundCore\Stdlib\Hydrator\Strategy;

use Laminas\Hydrator\Strategy\StrategyInterface;
use DoctrineModule\Stdlib\Hydrator\Strategy\AbstractCollectionStrategy;
use Doctrine\Laminas\Hydrator\Strategy\AbstractCollectionStrategy;
use Doctrine\Laminas\Hydrator\Strategy\CollectionStrategyInterface;

// This class fill a gap in Doctrine Hydrator : When the attribute is an object, we have to call getId()
class ObjectStrategy extends AbstractCollectionStrategy implements StrategyInterface
class ObjectStrategy extends AbstractCollectionStrategy implements CollectionStrategyInterface
{
public function extract($value)
public function extract($value, ?object $object = null)
{
if (is_numeric($value) || $value === null) {
return $value;
Expand All @@ -16,7 +17,7 @@ public function extract($value)
return $value->getId();
}

public function hydrate($value)
public function hydrate($value, ?array $data)
{
return $value;
}
Expand Down

0 comments on commit 15c5ff3

Please sign in to comment.