Skip to content

Commit 8f6ea72

Browse files
committed
Cleanup: drop deprecated yaml support
1 parent 488bec7 commit 8f6ea72

File tree

6 files changed

+1
-182
lines changed

6 files changed

+1
-182
lines changed

.docs/README.md

-40
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
- [Attributes](#attributes)
1212
- [Annotations](#annotations)
1313
- [XML](#xml)
14-
- [YAML](#yaml)
1514
- [Helpers](#helpers)
1615
- [Examples](#examples)
1716
- [Other](#other)
@@ -188,7 +187,6 @@ Additional metadata provider needs to be registered. We provide bridges for thes
188187

189188
- **attributes** (`Nettrine\ORM\DI\OrmAttributesExtension`)
190189
- **annotations** (`Nettrine\ORM\DI\OrmAnnotationsExtension`)
191-
- **yaml** (`Nettrine\ORM\DI\OrmYamlExtension`)
192190
- **xml** (`Nettrine\ORM\DI\OrmXmlExtension`)
193191

194192

@@ -343,43 +341,6 @@ nettrine.orm.xml:
343341
Using **simple** you will enable [`SimplifiedXmlDriver`](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/xml-mapping.html#simplified-xml-driver).
344342

345343

346-
### YAML
347-
348-
Are you using [YAML mapping](https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/yaml-mapping.html) for your entities?
349-
350-
```yaml
351-
# Doctrine.Tests.ORM.Mapping.User.dcm.yml
352-
Doctrine\Tests\ORM\Mapping\User:
353-
type: entity
354-
repositoryClass: Doctrine\Tests\ORM\Mapping\UserRepository
355-
table: cms_users
356-
schema: schema_name
357-
readOnly: true
358-
indexes:
359-
name_index:
360-
columns: [ name ]
361-
id:
362-
id:
363-
type: integer
364-
generator:
365-
strategy: AUTO
366-
```
367-
368-
You will also appreciate ORM => YAML bridge, use `OrmYamlExtension`. This is the default configuration:
369-
370-
```neon
371-
extensions:
372-
nettrine.orm: Nettrine\ORM\DI\OrmExtension
373-
nettrine.orm.yaml: Nettrine\ORM\DI\OrmYamlExtension
374-
375-
nettrine.orm.yaml:
376-
mapping: [
377-
namespace: path
378-
]
379-
fileExtension: .orm.yml
380-
```
381-
382-
383344
### Helpers
384345

385346
**MappingHelper**
@@ -400,7 +361,6 @@ class CategoryExtension extends CompilerExtension
400361
->addAnnotation('Forum\Modules\Database', __DIR__ . '/../../modules/Forum/Database')
401362
->addXml('Gallery1\Modules\Database', __DIR__ . '/../../modules/Gallery1/Database')
402363
->addXml('Gallery2\Modules\Database', __DIR__ . '/../../modules/Gallery2/Database', $simple = TRUE)
403-
->addYaml('Users\Modules\Database', __DIR__ . '/../../modules/Users/Database');
404364
}
405365

406366
}

src/DI/Helpers/MappingHelper.php

-18
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
use Nettrine\ORM\DI\OrmAttributesExtension;
1111
use Nettrine\ORM\DI\OrmExtension;
1212
use Nettrine\ORM\DI\OrmXmlExtension;
13-
use Nettrine\ORM\DI\OrmYamlExtension;
1413
use Nettrine\ORM\Exception\Logical\InvalidStateException;
1514

1615
class MappingHelper
@@ -84,23 +83,6 @@ public function addXml(string $namespace, string $path, bool $simple = false): s
8483
return $this;
8584
}
8685

87-
public function addYaml(string $namespace, string $path): self
88-
{
89-
if (!is_dir($path)) {
90-
throw new InvalidStateException(sprintf('Given mapping path "%s" does not exist', $path));
91-
}
92-
93-
/** @var ServiceDefinition $yamlDriver */
94-
$yamlDriver = $this->getService(OrmYamlExtension::DRIVER_TAG, 'YamlDriver');
95-
$yamlDriver->addSetup(new Statement('$service->getLocator()->addNamespacePrefixes([? => ?])', [$path, $namespace]));
96-
97-
/** @var ServiceDefinition $chainDriver */
98-
$chainDriver = $this->getService(OrmExtension::MAPPING_DRIVER_TAG, 'MappingDriverChain');
99-
$chainDriver->addSetup('addDriver', [$yamlDriver, $namespace]);
100-
101-
return $this;
102-
}
103-
10486
private function getService(string $tag, string $name): Definition
10587
{
10688
$builder = $this->extension->getContainerBuilder();

src/DI/OrmYamlExtension.php

-59
This file was deleted.

tests/Cases/DI/OrmYamlExtension.phpt

-49
This file was deleted.

tests/Cases/E2E/EntityMapping.phpt

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<?php declare(strict_types = 1);
22

33
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
4-
use Doctrine\ORM\Mapping\Driver\SimplifiedYamlDriver;
54
use Doctrine\ORM\Mapping\Driver\XmlDriver;
65
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
76
use Nette\DI\Compiler;
87
use Nettrine\Annotations\DI\AnnotationsExtension;
98
use Nettrine\ORM\DI\OrmAnnotationsExtension;
109
use Nettrine\ORM\DI\OrmXmlExtension;
11-
use Nettrine\ORM\DI\OrmYamlExtension;
1210
use Ninjify\Nunjuck\Toolkit;
1311
use Tester\Assert;
1412
use Tests\Fixtures\EntityMappingCompilerExtension;
@@ -25,7 +23,6 @@ Toolkit::test(function (): void {
2523
$compiler->addExtension('annotations', new AnnotationsExtension());
2624
$compiler->addExtension('nettrine.orm.annotations', new OrmAnnotationsExtension());
2725
$compiler->addExtension('nettrine.orm.xml', new OrmXmlExtension());
28-
$compiler->addExtension('nettrine.orm.yaml', new OrmYamlExtension());
2926
$compiler->addExtension('tests.mapping', new EntityMappingCompilerExtension());
3027
$compiler->addConfig(Helpers::neon('
3128
nettrine.orm.annotations:
@@ -34,9 +31,6 @@ Toolkit::test(function (): void {
3431
nettrine.orm.xml:
3532
mapping:
3633
App\Model\Entity2: %appDir%
37-
nettrine.orm.yaml:
38-
mapping:
39-
App\Model\Entity3: %appDir%
4034
'));
4135
})
4236
->build();
@@ -57,15 +51,7 @@ Toolkit::test(function (): void {
5751
Tests::FIXTURES_PATH,
5852
], array_values($xmlDriver->getLocator()->getPaths()));
5953

60-
/** @var SimplifiedYamlDriver $yamlDriver */
61-
$yamlDriver = $container->getService(current(array_keys($container->findByTag(OrmYamlExtension::DRIVER_TAG))));
62-
63-
Assert::equal([
64-
Tests::APP_PATH,
65-
Tests::FIXTURES_PATH,
66-
], array_values($yamlDriver->getLocator()->getPaths()));
67-
6854
/** @var MappingDriverChain $chainDriver */
6955
$chainDriver = $container->getService('nettrine.orm.mappingDriver');
70-
Assert::count(6, $chainDriver->getDrivers());
56+
Assert::count(4, $chainDriver->getDrivers());
7157
});

tests/Fixtures/EntityMappingCompilerExtension.php

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ public function beforeCompile(): void
1313
{
1414
MappingHelper::of($this)->addAnnotation('Tests1', Tests::FIXTURES_PATH);
1515
MappingHelper::of($this)->addXml('Tests2', Tests::FIXTURES_PATH);
16-
MappingHelper::of($this)->addYaml('Tests3', Tests::FIXTURES_PATH);
1716
}
1817

1918
}

0 commit comments

Comments
 (0)