Strange behavior when editing DataObjets with image_relation | plain 4.3 installation!


#1

Silverstripe 4.3

I’'m managing a dataobjet with the gridfield componenet. DataObject (DO) has a has_one relation to image.
Strangely when going into editing a DO, the image that is shown is always the one from the first DO I edited. I need to press F5 to get the right image. If I save the DO without refreshing, the Image from the first DO that I edited is linked to the current DO… ???

The DataObject:


namespace Schrattenholz\Test;

use Page;
use Silverstripe\ORM\DataObject;
use SilverStripe\Assets\Image;

class DObject extends DataObject{
	private static $table_name="dobject";
	private static $has_one=[
		'Bild'=>Image::class,
		'Page'=>Page::class
	];
		private static $owns=[
			'Bild'
		];
		public function onAfterWrite()
 {
   parent::onAfterWrite();
    if ($this->Bild()->exists() && !$this->Bild()->isPublished())
       {
	  $this->Bild()->doPublish();
	}
 }
}

The PageType:


namespace Schrattenholz\Test;

use Page;
use SilverStripe\Forms\GridField\GridField;
use SilverStripe\Forms\GridField\GridFieldConfig_RecordEditor;

class Test extends Page{
	
	private static $db=[];
	private static $has_many=[
		'Objects'=>DObject::class
	];
	public function getCMSFields(){
		$fields=parent::getCMSFields();
		$fields->addFieldToTab('Root.Objects', GridField::create(
            'Objects',
            'Objects on this page',
            $this->Objects(),
            GridFieldConfig_RecordEditor::create()
        ));
		return $fields;
	}
	
}

#2

Sounds like it might be this issue:


#3

Thanks a lot. So downgrading is the only Option?


#5

a related one was fixed in asset admin (or at least we experienced it), we’re on 4.3.3 and not getting it anymore: https://github.com/silverstripe/silverstripe-asset-admin/issues/919


#4

Not the only option. There’s a fix in progress by the look of things… if it hasn’t already been merged in… just trying to follow the trail!