Login | Forgot password | Register
What is OpenID?
OpenID is an Internet-wide identity system that allows you to sign in to many websites with a single account.
With OpenID, your ID becomes a URL (e.g. http://username.myopenid.com/). You can get a free OpenID for example from myopenid.com.
For more information visit the official OpenID site.
Archive
SilverStripe Forums » Archive » DataObjectSet::append() is deprecated ?
Our old forums are still available as a read-only archive.
|
Page:
1
|
Go to End | |
| Author | Topic: DataObjectSet::append() is deprecated ? | 776 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);
| 776 Views | ||
|
Page:
1
|
Go to Top |
Currently Online: xterso, joelg, Webdoc
Welcome to our latest member: AlfonsoGrondo



