Entity NotifyOrderCreate
/** * @ORM\Column(type="bigint",options={"unsigned"=true}) * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @ORM\OneToOne(targetEntity="Order", inversedBy="notifyCreate",cascade={"persist"}) * @ORM\JoinColumn(name="order_id", referencedColumnName="id",onDelete="CASCADE") **/ private $order;
Entity Order
/** * @ORM\Column(type="bigint",options={"unsigned"=true}) * @ORM\Id * @ORM\GeneratedValue(strategy="AUTO") */ private $id; /** * @ORM\OneToOne(targetEntity="NotifyOrderCreate", mappedBy="order") **/ private $notifyCreate;
Find out that NotifyOrderCreate will also delete the order when executing remove. Please tell me how to break it.
I don’t understand how to write comments. Given below is the yml code:
This way of writing will set the field to NULL when deleting.