Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Combining 2 DataObjectSet

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Page: 1
Go to End
Author Topic: 1589 Views
  • freeyland
    Avatar
    Community Member
    22 Posts

    Combining 2 DataObjectSet Link to this post

    Hi is there a way to combine 2 DataObjects into 1?

  • Andy
    Avatar
    230 Posts

    Re: Combining 2 DataObjectSet Link to this post

    I'm assuming you mean DataObjectSet as your topic says, not DataObject as your post says.

    DataObjectSet has a function called merge that does this, so you can just go:

    $doSet1->merge($doSet2);

  • freeyland
    Avatar
    Community Member
    22 Posts

    Re: Combining 2 DataObjectSet Link to this post

    Thx for the reply!

    It is combining the 2 ObjectSets, but as seperate arrays.
    In the template it will loop and find 2 Objects (with Control). I want only to display once the content.

    * ArrayData::__set_state(array( 'array' => array ( 'text' => 'Partly Cloudy', 'code' => '30', 'temp' => '19', 'date' => 'Thu, 09 Aug 2007 1:55 pm CEST', ), 'iteratorPos' => 0, 'iteratorTotalItems' => 2, 'failover' => NULL, '_object_cache' => array ( ), '_xml_cache' => array ( ), '_natural_cache' => array ( ), 'customisedObj' => NULL, 'show' => NULL, 'parent' => NULL, 'namedAs' => NULL, 'class' => 'ArrayData', ))
    * ArrayData::__set_state(array( 'array' => array ( 'city' => 'Hermagor', 'region' => '', 'country' => 'AU', ), 'iteratorPos' => 1, 'iteratorTotalItems' => 2, 'failover' => NULL, '_object_cache' => array ( ), '_xml_cache' => array ( ), '_natural_cache' => array ( ), 'customisedObj' => NULL, 'show' => NULL, 'parent' => NULL, 'namedAs' => NULL, 'class' => 'ArrayData', ))

    1589 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.