Skip to content

Commit

Permalink
Merge remote-tracking branch 'IonBazan/attribute-driver' into attribu…
Browse files Browse the repository at this point in the history
…te-driver
  • Loading branch information
IonBazan committed Aug 6, 2021
2 parents 2b165ed + d2f182e commit 38c948f
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Filename extends AbstractField
{
public function __construct(?string $name = 'filename')
public function __construct()
{
parent::__construct($name, 'string', false, [], null, true);
parent::__construct('filename', 'string', false, [], null, true);
}
}
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/Annotations/File/Length.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#[Attribute(Attribute::TARGET_PROPERTY)]
final class Length extends AbstractField
{
public function __construct(?string $name = 'length')
public function __construct()
{
parent::__construct($name, 'int', false, [], null, true);
parent::__construct('length', 'int', false, [], null, true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ final class Metadata extends AbstractField
public $defaultDiscriminatorValue;

public function __construct(
?string $name = 'metadata',
bool $nullable = false,
array $options = [],
?string $strategy = null,
Expand All @@ -42,7 +41,7 @@ public function __construct(
?array $discriminatorMap = null,
?string $defaultDiscriminatorValue = null
) {
parent::__construct($name, ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);
parent::__construct('metadata', ClassMetadata::ONE, $nullable, $options, $strategy, $notSaved);

$this->targetDocument = $targetDocument;
$this->discriminatorField = $discriminatorField;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#[Attribute(Attribute::TARGET_PROPERTY)]
final class UploadDate extends AbstractField
{
public function __construct(?string $name = 'uploadDate', string $type = 'date')
public function __construct()
{
parent::__construct($name, $type, false, [], null, true);
parent::__construct('uploadDate', 'date', false, [], null, true);
}
}
2 changes: 0 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,6 @@ private function setShardKey(ClassMetadata $class, ODM\ShardKey $shardKey): void
* Factory method for the Annotation Driver
*
* @param string[]|string $paths
*
* @return static
*/
public static function create($paths = [], ?Reader $reader = null): AnnotationDriver
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/Driver/AttributeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ public function __construct(array $paths, ?Reader $reader = null)
* Factory method for the Attribute Driver
*
* @param string[]|string $paths
*
* @return AttributeDriver
*/
public static function create($paths = [], ?Reader $reader = null): AnnotationDriver
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Doctrine\ODM\MongoDB\Tests\Mapping;

use Doctrine\ODM\MongoDB\Mapping\Driver\AttributeDriver;
use Doctrine\ODM\MongoDB\Mapping\Driver\AttributeReader;
use Doctrine\Persistence\Mapping\Driver\MappingDriver;

/**
Expand All @@ -15,8 +14,6 @@ class AttributeDriverTest extends AbstractAnnotationDriverTest
{
protected function loadDriver(): MappingDriver
{
$reader = new AttributeReader();

return new AttributeDriver($reader);
return AttributeDriver::create();
}
}

0 comments on commit 38c948f

Please sign in to comment.