Doctrine Merge没有按预期工作

I am getting the following json data from the client. JSON contains the parent and child details as below -

{
  id : 1,
  name : "Parent"
  children : [
      { id : 1, name : "A" },
      { id : 2, name : "B" }
   ]
}

I am mapping these json data to Parent and Child Object.

Parent

class Parent{


    /** @Id @Column(type="integer",name="order_no") @GeneratedValue * */
    protected $id;

     /**
     * @OneToMany(targetEntity="Child",cascade={"merge"}, mappedBy="parent" )
     */
    protected $children;

}

Child

class SalesOrderDetail extends BaseEntity {

    /** @Id @Column(type="integer") @GeneratedValue * */
    protected $id;

    /**
     * @ManyToOne(targetEntity="parent")
     * @JoinColumn(name="parent_id")
     */
    protected $salesOrder;

}

So far so good.

Now the issue is when I am trying to merge the parent

$em->merge($parent)

I am getting the following error. Note : The entire object parent and children are unmanaged object so I am trying to merge. If I just merge parent it works find but getting error if I am trying to save entire content of parent and its children.

Type: Doctrine\ORM\ORMInvalidArgumentException Message: Multiple non-persisted new entities were found through the given association graph: * A new entity was found through the relationship 'Ziletech\Database\Entity\Parent#itemSet' that was not configured to cascade persist operations for entity: Ziletech\Database\Entity\Child@0000000052218380000000007058b4a6. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'Ziletech\Database\Entity\Child#__toString()' to get a clue. * A new entity was found through the relationship 'Ziletech\Database\Entity\Parent#itemSet' that was not configured to cascade persist operations for entity: Ziletech\Database\Entity\Child@0000000052218071000000007058b4a6. To solve this issue: Either explicitly call EntityManager#persist() on this unknown entity or configure cascade persist this association in the mapping for example @ManyToOne(..,cascade={"persist"}). If you cannot find out which entity causes the problem implement 'Ziletech\Database\Entity\Child#__toString()' to get a clue.