Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,35 @@ final class ManyToManyTagValueNode extends AbstractDoctrineTagValueNode implemen
private $cascade;

/**
* @var string
* @var string|null
*/
private $fetch;

/**
* @var bool
* @var bool|null
*/
private $orphanRemoval = false;
private $orphanRemoval;

/**
* @var string|null
*/
private $indexBy;

/**
* @var string
* @var string|null
*/
private $fqnTargetEntity;

public function __construct(
string $targetEntity,
?string $mappedBy,
?string $inversedBy,
?array $cascade,
string $fetch,
bool $orphanRemoval,
?string $indexBy,
string $originalContent,
string $fqnTargetEntity
?string $mappedBy = null,
?string $inversedBy = null,
?array $cascade = null,
?string $fetch = null,
?bool $orphanRemoval = null,
?string $indexBy = null,
?string $originalContent = null,
?string $fqnTargetEntity = null
) {
$this->targetEntity = $targetEntity;
$this->mappedBy = $mappedBy;
Expand All @@ -76,7 +76,9 @@ public function __construct(
$this->indexBy = $indexBy;
$this->fqnTargetEntity = $fqnTargetEntity;

$this->resolveOriginalContentSpacingAndOrder($originalContent);
if ($originalContent !== null) {
$this->resolveOriginalContentSpacingAndOrder($originalContent);
}
}

public function __toString(): string
Expand All @@ -93,23 +95,31 @@ public function __toString(): string
$contentItems['inversedBy'] = sprintf('inversedBy="%s"', $this->inversedBy);
}

if ($this->cascade) {
if ($this->cascade !== null) {
$contentItems['cascade'] = $this->printArrayItem($this->cascade, 'cascade');
}

$contentItems['fetch'] = sprintf('fetch="%s"', $this->fetch);
$contentItems['orphanRemoval'] = sprintf('orphanRemoval=%s', $this->orphanRemoval ? 'true' : 'false');
$contentItems['indexBy'] = sprintf('indexBy="%s"', $this->indexBy);
if ($this->fetch !== null) {
$contentItems['fetch'] = sprintf('fetch="%s"', $this->fetch);
}

if ($this->orphanRemoval !== null) {
$contentItems['orphanRemoval'] = sprintf('orphanRemoval=%s', $this->orphanRemoval ? 'true' : 'false');
}

if ($this->indexBy !== null) {
$contentItems['indexBy'] = sprintf('indexBy="%s"', $this->indexBy);
}

return $this->printContentItems($contentItems);
}

public function getTargetEntity(): ?string
public function getTargetEntity(): string
{
return $this->targetEntity;
}

public function getFqnTargetEntity(): string
public function getFqnTargetEntity(): ?string
{
return $this->fqnTargetEntity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ final class OneToManyTagValueNode extends AbstractDoctrineTagValueNode implement
private $cascade;

/**
* @var string
* @var string|null
*/
private $fetch;

/**
* @var bool
* @var bool|null
*/
private $orphanRemoval = false;

Expand All @@ -46,19 +46,19 @@ final class OneToManyTagValueNode extends AbstractDoctrineTagValueNode implement
private $indexBy;

/**
* @var string
* @var string|null
*/
private $fqnTargetEntity;

public function __construct(
?string $mappedBy,
?string $mappedBy = null,
string $targetEntity,
?array $cascade,
string $fetch,
bool $orphanRemoval,
?string $indexBy,
?string $originalContent,
string $fqnTargetEntity
?array $cascade = null,
?string $fetch = null,
?bool $orphanRemoval = null,
?string $indexBy = null,
?string $originalContent = null,
?string $fqnTargetEntity = null
) {
$this->mappedBy = $mappedBy;
$this->targetEntity = $targetEntity;
Expand All @@ -75,15 +75,26 @@ public function __toString(): string
{
$contentItems = [];

$contentItems['mappedBy'] = sprintf('mappedBy="%s"', $this->mappedBy);
if ($this->mappedBy !== null) {
$contentItems['mappedBy'] = sprintf('mappedBy="%s"', $this->mappedBy);
}
$contentItems['targetEntity'] = sprintf('targetEntity="%s"', $this->targetEntity);

if ($this->cascade) {
$contentItems['cascade'] = $this->printArrayItem($this->cascade, 'cascade');
}
$contentItems['fetch'] = sprintf('fetch="%s"', $this->fetch);
$contentItems['orphanRemoval'] = sprintf('orphanRemoval=%s', $this->orphanRemoval ? 'true' : 'false');
$contentItems['indexBy'] = sprintf('indexBy="%s"', $this->indexBy);

if ($this->fetch !== null) {
$contentItems['fetch'] = sprintf('fetch="%s"', $this->fetch);
}

if ($this->orphanRemoval !== null) {
$contentItems['orphanRemoval'] = sprintf('orphanRemoval=%s', $this->orphanRemoval ? 'true' : 'false');
}

if ($this->indexBy !== null) {
$contentItems['indexBy'] = sprintf('indexBy="%s"', $this->indexBy);
}

return $this->printContentItems($contentItems);
}
Expand All @@ -93,7 +104,7 @@ public function getTargetEntity(): string
return $this->targetEntity;
}

public function getFqnTargetEntity(): string
public function getFqnTargetEntity(): ?string
{
return $this->fqnTargetEntity;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ final class OneToOneTagValueNode extends AbstractDoctrineTagValueNode implements
private $fetch;

/**
* @var bool
* @var bool|null
*/
private $orphanRemoval = false;

/**
* @var string
* @var string|null
*/
private $fqnTargetEntity;

Expand All @@ -56,13 +56,13 @@ final class OneToOneTagValueNode extends AbstractDoctrineTagValueNode implements
*/
public function __construct(
string $targetEntity,
?string $mappedBy,
?string $inversedBy,
?array $cascade,
?string $fetch,
bool $orphanRemoval,
?string $originalContent,
string $fqnTargetEntity
?string $mappedBy = null,
?string $inversedBy = null,
?array $cascade = null,
?string $fetch = null,
?bool $orphanRemoval = null,
?string $originalContent = null,
?string $fqnTargetEntity = null
) {
$this->targetEntity = $targetEntity;
$this->mappedBy = $mappedBy;
Expand Down Expand Up @@ -93,8 +93,13 @@ public function __toString(): string
$contentItems['cascade'] = $this->printArrayItem($this->cascade, 'cascade');
}

$contentItems['fetch'] = sprintf('fetch="%s"', $this->fetch);
$contentItems['orphanRemoval'] = sprintf('orphanRemoval=%s', $this->orphanRemoval ? 'true' : 'false');
if ($this->fetch !== null) {
$contentItems['fetch'] = sprintf('fetch="%s"', $this->fetch);
}

if ($this->orphanRemoval !== null) {
$contentItems['orphanRemoval'] = sprintf('orphanRemoval=%s', $this->orphanRemoval ? 'true' : 'false');
}

return $this->printContentItems($contentItems);
}
Expand All @@ -104,7 +109,7 @@ public function getTargetEntity(): ?string
return $this->targetEntity;
}

public function getFqnTargetEntity(): string
public function getFqnTargetEntity(): ?string
{
return $this->fqnTargetEntity;
}
Expand Down
Loading