-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce the Revisionable extension
- Loading branch information
Showing
94 changed files
with
5,625 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,11 @@ | |
* The AbstractTrackingListener provides generic functions for all listeners. | ||
* | ||
* @author Gediminas Morkevicius <[email protected]> | ||
* | ||
* @template TConfig of array | ||
* @template TEventAdapter of AdapterInterface | ||
* | ||
* @extends MappedEventSubscriber<TConfig, TEventAdapter> | ||
*/ | ||
abstract class AbstractTrackingListener extends MappedEventSubscriber | ||
{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
|
||
use Doctrine\Persistence\Mapping\ClassMetadata; | ||
use Gedmo\AbstractTrackingListener; | ||
use Gedmo\Blameable\Mapping\Event\BlameableAdapter; | ||
use Gedmo\Exception\InvalidArgumentException; | ||
|
||
/** | ||
|
@@ -19,6 +20,8 @@ | |
* | ||
* @author Gediminas Morkevicius <[email protected]> | ||
* | ||
* @extends AbstractTrackingListener<array, BlameableAdapter> | ||
* | ||
* @final since gedmo/doctrine-extensions 3.11 | ||
*/ | ||
class BlameableListener extends AbstractTrackingListener | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
use Doctrine\Persistence\Mapping\ClassMetadata; | ||
use Gedmo\AbstractTrackingListener; | ||
use Gedmo\Exception\InvalidArgumentException; | ||
use Gedmo\IpTraceable\Mapping\Event\IpTraceableAdapter; | ||
use Gedmo\Mapping\Event\AdapterInterface; | ||
|
||
/** | ||
|
@@ -20,6 +21,8 @@ | |
* | ||
* @author Pierre-Charles Bertineau <[email protected]> | ||
* | ||
* @extends AbstractTrackingListener<array, IpTraceableAdapter> | ||
* | ||
* @final since gedmo/doctrine-extensions 3.11 | ||
*/ | ||
class IpTraceableListener extends AbstractTrackingListener | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Doctrine Behavioral Extensions package. | ||
* (c) Gediminas Morkevicius <[email protected]> http://www.gediminasm.org | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Gedmo\Mapping\Annotation; | ||
|
||
use Doctrine\Common\Annotations\Annotation; | ||
use Doctrine\Deprecations\Deprecation; | ||
use Gedmo\Mapping\Annotation\Annotation as GedmoAnnotation; | ||
use Gedmo\Revisionable\RevisionInterface; | ||
|
||
/** | ||
* Revisionable annotation for the revisionable behavioral extension | ||
* | ||
* @phpstan-template T of RevisionInterface | ||
* | ||
* @Annotation | ||
* | ||
* @NamedArgumentConstructor | ||
* | ||
* @Target("CLASS") | ||
* | ||
* @author Gediminas Morkevicius <[email protected]> | ||
*/ | ||
#[\Attribute(\Attribute::TARGET_CLASS)] | ||
final class Revisionable implements GedmoAnnotation | ||
{ | ||
use ForwardCompatibilityTrait; | ||
|
||
/** | ||
* @phpstan-var class-string<T>|null | ||
*/ | ||
public ?string $revisionClass; | ||
|
||
/** | ||
* @param array<string, mixed> $data | ||
* | ||
* @phpstan-param class-string<T>|null $revisionClass | ||
*/ | ||
public function __construct(array $data = [], ?string $revisionClass = null) | ||
{ | ||
if ([] !== $data) { | ||
Deprecation::trigger( | ||
'gedmo/doctrine-extensions', | ||
'https://github.com/doctrine-extensions/DoctrineExtensions/pull/2357', | ||
'Passing an array as first argument to "%s()" is deprecated. Use named arguments instead.', | ||
__METHOD__ | ||
); | ||
|
||
$args = func_get_args(); | ||
|
||
$this->revisionClass = $this->getAttributeValue($data, 'revisionClass', $args, 1, $revisionClass); | ||
|
||
return; | ||
} | ||
|
||
$this->revisionClass = $revisionClass; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,9 +27,6 @@ | |
use Gedmo\Mapping\Driver\AttributeReader; | ||
use Gedmo\Mapping\Event\AdapterInterface; | ||
use Gedmo\Mapping\Event\ClockAwareAdapterInterface; | ||
use Gedmo\ReferenceIntegrity\Mapping\Validator as ReferenceIntegrityValidator; | ||
use Gedmo\Uploadable\FilenameGenerator\FilenameGeneratorInterface; | ||
use Gedmo\Uploadable\Mapping\Validator as MappingValidator; | ||
use Psr\Cache\CacheItemPoolInterface; | ||
use Psr\Clock\ClockInterface; | ||
use Symfony\Component\Cache\Adapter\ArrayAdapter; | ||
|
@@ -44,6 +41,9 @@ | |
* extended drivers | ||
* | ||
* @author Gediminas Morkevicius <[email protected]> | ||
* | ||
* @template TConfig of array | ||
* @template TEventAdapter of AdapterInterface | ||
*/ | ||
abstract class MappedEventSubscriber implements EventSubscriber | ||
{ | ||
|
@@ -115,24 +115,7 @@ public function __construct() | |
* | ||
* @return array<string, mixed> | ||
* | ||
* @phpstan-return array{ | ||
* useObjectClass?: class-string, | ||
* referenceIntegrity?: array<string, array<string, value-of<ReferenceIntegrityValidator::INTEGRITY_ACTIONS>>>, | ||
* filePathField?: string, | ||
* uploadable?: bool, | ||
* fileNameField?: string, | ||
* allowOverwrite?: bool, | ||
* appendNumber?: bool, | ||
* maxSize?: float, | ||
* path?: string, | ||
* pathMethod?: string, | ||
* allowedTypes?: string[], | ||
* disallowedTypes?: string[], | ||
* filenameGenerator?: MappingValidator::FILENAME_GENERATOR_*|class-string<FilenameGeneratorInterface>, | ||
* fileMimeTypeField?: string, | ||
* fileSizeField?: string, | ||
* callback?: string, | ||
* } | ||
* @phpstan-return TConfig | ||
*/ | ||
public function getConfiguration(ObjectManager $objectManager, $class) | ||
{ | ||
|
@@ -273,6 +256,8 @@ public function loadMetadataForObjectClass(ObjectManager $objectManager, $metada | |
* @throws InvalidArgumentException if event is not recognized | ||
* | ||
* @return AdapterInterface | ||
* | ||
* @phpstan-return TEventAdapter | ||
*/ | ||
protected function getEventAdapter(EventArgs $args) | ||
{ | ||
|
Oops, something went wrong.