Skip to content

Commit

Permalink
remove obsolete annotation mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Jan 6, 2024
1 parent a1728b1 commit 7b7bea6
Show file tree
Hide file tree
Showing 126 changed files with 221 additions and 1,588 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Changelog
* DocumentManager::flush no longer saves the PHPCR session if there are no changes
on the ODM layer.

* Removed deprecated annotations for fields. Use `@Field(type="...")` instead.
* Removed annotation mappings. Use attributes (or XML or YAML) instead.

### New Features

Expand Down
5 changes: 2 additions & 3 deletions cli-config.doctrine_dbal.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ if (isset($argv[1])

/* prepare the doctrine configuration */
$config = new \Doctrine\ODM\PHPCR\Configuration();
$driver = new \Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver(
new \Doctrine\Common\Annotations\AnnotationReader(),
$driver = new \Doctrine\ODM\PHPCR\Mapping\Driver\AttributeDriver([
__DIR__ . '/lib/Doctrine/ODM/PHPCR/Document'
);
]);
$config->setMetadataDriverImpl($driver);

$dm = \Doctrine\ODM\PHPCR\DocumentManager::create($session, $config);
Expand Down
5 changes: 2 additions & 3 deletions cli-config.jackrabbit.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ $session = $repository->login($credentials, $workspace);

/* prepare the doctrine configuration */
$config = new \Doctrine\ODM\PHPCR\Configuration();
$driver = new \Doctrine\ODM\PHPCR\Mapping\Driver\AnnotationDriver(
new \Doctrine\Common\Annotations\AnnotationReader(),
$driver = new \Doctrine\ODM\PHPCR\Mapping\Driver\AttributeDriver([
__DIR__ . '/lib/Doctrine/ODM/PHPCR/Document'
);
]);
$config->setMetadataDriverImpl($driver);

$dm = \Doctrine\ODM\PHPCR\DocumentManager::create($session, $config);
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/Document/AbstractFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
namespace Doctrine\ODM\PHPCR\Document;

use Doctrine\ODM\PHPCR\HierarchyInterface;
use PHPCR\NodeInterface;
use Doctrine\ODM\PHPCR\Mapping\Attributes as PHPCR;
use PHPCR\NodeInterface;

/**
* This class represents an abstract "file".
Expand Down
10 changes: 6 additions & 4 deletions lib/Doctrine/ODM/PHPCR/Document/Generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
/**
* This class represents an arbitrary node.
*
* It is used as a default document, for example with the ParentDocument annotation.
* You can not use this to create nodes as it has no type annotation.
* It is used as a default document, for example with the ParentDocument mapping.
* You can not use this to create nodes as it has no type mapping.
*/
#[PHPCR\Document]
class Generic
Expand All @@ -30,7 +30,7 @@ class Generic
protected string $nodename = '';

#[PHPCR\ParentDocument]
protected object $parent;
protected ?object $parent;

/**
* @var Collection<object>
Expand All @@ -51,13 +51,14 @@ public function __construct()
}

/**
* Id (path) of this document
* Id (path) of this document.
*/
public function getId(): string
{
if (!isset($this->id)) {
throw new BadMethodCallException('Do not call getId on unsaved objects.');
}

return $this->id;
}

Expand Down Expand Up @@ -95,6 +96,7 @@ public function getParentDocument(): object
if (!isset($this->parent)) {
throw new BadMethodCallException('Do not call getParentDocument on unsaved objects before setting the parent.');
}

return $this->parent;
}

Expand Down
8 changes: 3 additions & 5 deletions lib/Doctrine/ODM/PHPCR/Document/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@
*/
#[PHPCR\Document(nodeType: 'nt:resource')]
class Resource
{ #[PHPCR\Id]
{
#[PHPCR\Id]
protected string $id;

/**
* @var NodeInterface
*/
#[PHPCR\Node]
protected NodeInterface $node;

Expand Down Expand Up @@ -88,7 +86,7 @@ public function setParentDocument(object $parent): self

/**
* Set the data from a binary stream.
*
* @param resource $data the contents of this resource
*/
public function setData($data): self
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function hasLocaleChooserStrategy(): bool
public function getLocaleChooserStrategy(): LocaleChooserInterface
{
if (!isset($this->localeChooserStrategy)) {
throw new InvalidArgumentException('You must configure a language chooser strategy when having documents with the translatable annotation');
throw new InvalidArgumentException('You must configure a language chooser strategy when having documents with the translatable mapping');
}

return $this->localeChooserStrategy;
Expand Down
22 changes: 0 additions & 22 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Child.php

This file was deleted.

26 changes: 0 additions & 26 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Children.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Depth.php

This file was deleted.

28 changes: 0 additions & 28 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Document.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Field.php

This file was deleted.

16 changes: 0 additions & 16 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Id.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Locale.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/MappedSuperclass.php

This file was deleted.

14 changes: 0 additions & 14 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/MixedReferrers.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Node.php

This file was deleted.

15 changes: 0 additions & 15 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/Nodename.php

This file was deleted.

20 changes: 0 additions & 20 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/ParentDocument.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/PostLoad.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/PostPersist.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/PostRemove.php

This file was deleted.

13 changes: 0 additions & 13 deletions lib/Doctrine/ODM/PHPCR/Mapping/Annotations/PostUpdate.php

This file was deleted.

Loading

0 comments on commit 7b7bea6

Please sign in to comment.