Do not cascade remove from resource node to resource format

Part 2
pull/5083/head
Angel Fernando Quiroz Campos 10 months ago
parent 17c4d66350
commit 1321137af5
  1. 2
      src/CoreBundle/Entity/ResourceFormat.php
  2. 6
      src/CoreBundle/Entity/ResourceNode.php

@ -30,7 +30,7 @@ class ResourceFormat
/**
* @var Collection<int, ResourceNode>
*/
#[ORM\OneToMany(targetEntity: ResourceNode::class, mappedBy: 'resourceFormat', cascade: ['persist', 'remove'])]
#[ORM\OneToMany(mappedBy: 'resourceFormat', targetEntity: ResourceNode::class)]
protected Collection $resourceNodes;
public function __construct()

@ -100,9 +100,9 @@ class ResourceNode implements Stringable
#[Gedmo\SortableGroup]
protected ResourceType $resourceType;
#[ORM\ManyToOne(targetEntity: ResourceFormat::class, cascade: ['persist'], inversedBy: 'resourceNodes')]
#[ORM\ManyToOne(targetEntity: ResourceFormat::class, inversedBy: 'resourceNodes')]
#[ORM\JoinColumn(name: 'resource_format_id', referencedColumnName: 'id')]
protected ResourceFormat $resourceFormat;
protected ?ResourceFormat $resourceFormat = null;
/**
* @var Collection<int, ResourceLink>
@ -388,7 +388,7 @@ class ResourceNode implements Stringable
return $this->resourceFormat;
}
public function setResourceFormat(ResourceFormat $resourceFormat): self
public function setResourceFormat(?ResourceFormat $resourceFormat): self
{
$this->resourceFormat = $resourceFormat;

Loading…
Cancel
Save