How to merge two php Doctrine 2 ArrayCollection()

前端 未结 8 1053
误落风尘
误落风尘 2020-12-08 01:21

Is there any convenience method that allows me to concatenate two Doctrine ArrayCollection()? something like:

$collection1 = new ArrayCollection         


        
8条回答
  •  臣服心动
    2020-12-08 02:12

    You can simply do:

    $a = new ArrayCollection();
    $b = new ArrayCollection();
    ...
    $c = new ArrayCollection(array_merge((array) $a, (array) $b));
    

提交回复
热议问题