2019-01-10 23:25:44 +01:00
|
|
|
<?php
|
|
|
|
|
2024-09-23 04:31:50 +02:00
|
|
|
namespace SilverStripe\Dev\Tests\ModelDataContainsTest;
|
2019-01-10 23:25:44 +01:00
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
2024-09-23 04:31:50 +02:00
|
|
|
use SilverStripe\Model\ModelData;
|
2019-01-10 23:25:44 +01:00
|
|
|
|
2024-09-23 04:31:50 +02:00
|
|
|
class TestObject extends ModelData implements TestOnly
|
2019-01-10 23:25:44 +01:00
|
|
|
{
|
|
|
|
protected $data = null;
|
|
|
|
|
|
|
|
public function __construct($data)
|
|
|
|
{
|
|
|
|
$this->data = $data;
|
|
|
|
}
|
|
|
|
|
2024-08-28 00:54:31 +02:00
|
|
|
public function hasField(string $fieldName): bool
|
2019-01-10 23:25:44 +01:00
|
|
|
{
|
2024-08-28 00:54:31 +02:00
|
|
|
return isset($this->data[$fieldName]);
|
2019-01-10 23:25:44 +01:00
|
|
|
}
|
|
|
|
|
2024-08-28 00:54:31 +02:00
|
|
|
public function getField(string $fieldName): mixed
|
2019-01-10 23:25:44 +01:00
|
|
|
{
|
2024-08-28 00:54:31 +02:00
|
|
|
return isset($this->data[$fieldName]) ?: null;
|
2019-01-10 23:25:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function getSomething()
|
|
|
|
{
|
|
|
|
return 'something';
|
|
|
|
}
|
|
|
|
}
|