Announcement

Collapse
No announcement yet.

Orm Merge Collection

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Orm Merge Collection

    Hi,
    it's possible to merge collection like :


    PHP Code:
    //two model has exactly same column
    $asia_best_seller App/AsiaSeller::select("name""sales_volume""birth_day""on_board_day")
       ->
    orderBy("sales_volume""desc")
       ->
    take(10)
       ->
    get();
    $euro_best_seller App/AsiaSeller::select("name""sales_volume""birth_day""on_board_day")
       ->
    orderBy("sales_volume""desc")
       ->
    take(10)
       ->
    get();

    $asia_best_seller->merge($euro_best_seller);
    //you will get only one collect !!​​ 

  • #2
    I've never needed that when developing for Espo. You can always cast to array.

    PHP Code:
            $collection = new EntityCollection([
                ...
    iterator_to_array($collection1),
                ...
    iterator_to_array($collection2),
            ]);
    ​ 

    Comment

    Working...
    X