Skip to content

Commit 7f11257

Browse files
authored
Merge pull request #11 from autorusltd/release/v1.17.0
v1.17.0
2 parents 9b37a21 + f696d9a commit 7f11257

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

src/ManagerRegistry.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,17 @@ public function __construct(Container $container)
7676
return $this->createManager($params);
7777
};
7878

79+
// deprecated...
7980
if (!empty($params['types'])) {
8081
$types += $params['types'];
8182
}
8283
}
8384

85+
/** @since 1.17.0 */
86+
if ($this->container->has('doctrine.types')) {
87+
$types += $this->container->get('doctrine.types');
88+
}
89+
8490
reset($connections);
8591
reset($managers);
8692

tests/Fixture/ContainerAwareTrait.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ private function getContainer() : Container
3838

3939
$container->set('doctrine', autowire(ManagerRegistry::class));
4040

41+
$container->set('doctrine.types', [
42+
Example3DbalType::NAME => Example3DbalType::class,
43+
]);
44+
4145
$container->set('doctrine.configuration', [
4246
'foo' => [
4347
'connection' => [

tests/Fixture/Example3DbalType.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php declare(strict_types=1);
2+
3+
namespace Arus\Doctrine\Bridge\Tests\Fixture;
4+
5+
/**
6+
* Import classes
7+
*/
8+
use Doctrine\DBAL\Platforms\AbstractPlatform;
9+
use Doctrine\DBAL\Types\Type;
10+
11+
/**
12+
* Example3DbalType
13+
*/
14+
final class Example3DbalType extends Type
15+
{
16+
17+
/**
18+
* Name of the type
19+
*
20+
* @var string
21+
*/
22+
public const NAME = 'test:example:3';
23+
24+
/**
25+
* {@inheritDoc}
26+
*/
27+
public function getName()
28+
{
29+
return self::NAME;
30+
}
31+
32+
/**
33+
* {@inheritDoc}
34+
*/
35+
public function getSQLDeclaration(array $field, AbstractPlatform $platform)
36+
{
37+
return $platform->getVarcharTypeDeclarationSQL($field);
38+
}
39+
}

tests/ManagerRegistryTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,5 +221,9 @@ public function testCustomTypes() : void
221221
$this->assertTrue(Type::hasType(
222222
Fixture\Example2DbalType::NAME
223223
));
224+
225+
$this->assertTrue(Type::hasType(
226+
Fixture\Example3DbalType::NAME
227+
));
224228
}
225229
}

0 commit comments

Comments
 (0)