2017-06-21 16:29:40 +12:00
|
|
|
<?php
|
|
|
|
|
2017-08-09 14:53:38 +12:00
|
|
|
namespace SilverStripe\CMS\Tests\Controllers;
|
2017-08-09 13:25:12 +12:00
|
|
|
|
2018-05-04 01:04:18 +00:00
|
|
|
use SilverStripe\CMS\Model\SiteTree;
|
2017-06-21 16:29:40 +12:00
|
|
|
use SilverStripe\Dev\TestOnly;
|
2024-09-23 14:37:02 +12:00
|
|
|
use SilverStripe\Core\Validation\ValidationException;
|
2017-08-09 13:25:12 +12:00
|
|
|
|
2018-05-04 01:04:18 +00:00
|
|
|
class CMSMainTest_ClassB extends SiteTree implements TestOnly
|
2017-06-21 16:29:40 +12:00
|
|
|
{
|
2017-08-09 14:53:38 +12:00
|
|
|
private static $table_name = 'CMSMainTest_ClassB';
|
|
|
|
|
2017-06-21 16:29:40 +12:00
|
|
|
protected function onBeforeWrite()
|
|
|
|
{
|
|
|
|
parent::onBeforeWrite();
|
|
|
|
|
2024-06-17 14:51:54 +12:00
|
|
|
if ($this->ClassName !== CMSMainTest_ClassB::class) {
|
2017-06-21 16:29:40 +12:00
|
|
|
throw new ValidationException("Class saved with incorrect ClassName");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|