17488 Posts in 4473 Topics by 1978 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 2171 Views |
-
DataObjectSet::append() is deprecated ?

7 August 2008 at 12:43am
Hi,
I get this notice after upgrading to 2.2.2 : DataObjectSet::append() is deprecated. Use DataObjectSet::merge() instead.But DataObjectSet::merge() is not 'compatible' with append. In the append method it is possible to append a DataObject to a DataObjectSet. With merge this is not possible.
So when I have a DataObjectSet, how can I append one DataObect to it?
$returnSet = new DataObjectSet();
$pages = DataObject::get("SiteTree","ParentID = " . $this->ID,"","");
if (!$pages) return null;
foreach ($pages as $p) {
if ($p->ClassName == 'VirtualPage') // VP
{
$np = DataObject::get_by_id('VirtualPage', $p->ID);
$newp = DataObject::get_by_id("SiteTree", $np->CopyContentFromID);
$returnSet->append($newp);
// cut // cut // cut -
Re: DataObjectSet::append() is deprecated ?

29 September 2008 at 7:54pm
//just a kick for some attention ;)
-
Re: DataObjectSet::append() is deprecated ?

30 September 2008 at 2:12am
Use DataObjectSet::push() instead.
-
Re: DataObjectSet::append() is deprecated ?

30 September 2008 at 5:42pm
Im pretty sure you can just call push() which should add it to the end, just like FlorianH has said
$returnSet->push($newp);
| 2171 Views | ||
|
Page:
1
|
Go to Top |



