for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @package elemental
*/
class ElementPublishChildren extends DataExtension
You can fix this by adding a namespace to your class:
namespace YourVendor; class YourClass { }
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.
{
public function onBeforeVersionedPublish()
$staged = array();
foreach ($this->owner->Elements() as $widget) {
$staged[] = $widget->ID;
$widget->publish('Stage', 'Live');
}
if($this->owner->ID) {
// remove any elements that are on live but not in draft.
$widgets = Versioned::get_by_stage('BaseElement', 'Live', sprintf(
"ListID = '%s'", $this->owner->ID
));
foreach ($widgets as $widget) {
if (!in_array($widget->ID, $staged)) {
$widget->deleteFromStage('Live');
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.