Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove obsolete annotation mapping #858

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"symfony/yaml": "^5.4 || ^6.0.19",
"symfony/phpunit-bridge": "^5.4.21 || ^6.0.19",
"liip/rmt": "^1.3",
"phpunit/phpunit": "^7.5 || ^8.0 || ^9.0"
"phpunit/phpunit": "^9.6.15"
},
"suggest": {
"symfony/yaml": "^5.4 || ^6.0",
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
4 changes: 4 additions & 0 deletions lib/Doctrine/ODM/PHPCR/Document/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ public function getContent(): Resource
* Set the content for this file from the given resource or string.
*
* @param resource|string $content the content for the file
*
* @phpstan-param closed-resource|string $content
*/
public function setFileContent($content): self
{
Expand All @@ -99,6 +101,8 @@ public function setFileContent($content): self
* Get a stream for the content of this file.
*
* @return resource the content for the file
*
* @phpstan-return closed-resource
*/
public function getFileContentAsStream()
{
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
14 changes: 9 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 All @@ -30,6 +28,8 @@ class Resource

/**
* @var resource
*
* @phpstan-var closed-resource
*/
#[PHPCR\Field(property: 'jcr:data', type: 'binary')]
protected $data;
Expand Down Expand Up @@ -88,8 +88,10 @@ public function setParentDocument(object $parent): self

/**
* Set the data from a binary stream.
*
* @param resource $data the contents of this resource
*
* @phpstan-param closed-resource $data the contents of this resource
*/
public function setData($data): self
{
Expand All @@ -102,6 +104,8 @@ public function setData($data): self
* Get the binary data stream of this resource.
*
* @return resource
*
* @phpstan-return closed-resource
*/
public function getData()
{
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
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/DocumentManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ public function findTranslation(?string $className, string $id, string $locale,
/**
* Quote a string for inclusion in an SQL2 query.
*
* @see \PHPCR\PropertyType
* @see PropertyType
*/
public function quote(string $val, int $type = PropertyType::STRING): string;

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.

Loading