Hello Matthew,
The expected behaviour in SS3 is covered by DataQuery Parameters feature. You should never specify tables for DataList with ‘_Live’ suffix.
When you call $dataList->dataQuery()->query() you should get properly formed SQLQuery with tabled renamed with ‘_Live’ suffix according to the environment.
When original SQLQuery was created, the method augmentSQL( $query ) is called on all assigned extensions. Versioned extension sets a special parameter Versioned.mode when DataQuery is created, and later uses it to augment SQL according to the set stage. So in your example when you call $object->delteFromStage(‘Live’) you should have properly formatted query (as $srcQuery in the DataObject::delete() method) with table names renamed with suffix ‘_Live’.
In your example of doDelete() you actually try to delete 3 times when dataobject have Versioned extension: from Live, from Stage, from Current Stage (should be Live by default, but then depends on CMS session). You missed ‘else’ there, since delete() is actually called inside deleteFromStage().
Gregory
--
You received this message because you are subscribed to the Google Groups "SilverStripe Core Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to silverstripe-d...@googlegroups.com.
To post to this group, send email to silverst...@googlegroups.com.
Visit this group at http://groups.google.com/group/silverstripe-dev.
For more options, visit https://groups.google.com/d/optout.