mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
e2e32317d6
Also rename ViewableData to ModelData ahead of the template layer lift-and-shift
32 lines
611 B
PHP
32 lines
611 B
PHP
<?php
|
|
|
|
namespace SilverStripe\Dev\Tests\ModelDataContainsTest;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\Model\ModelData;
|
|
|
|
class TestObject extends ModelData implements TestOnly
|
|
{
|
|
protected $data = null;
|
|
|
|
public function __construct($data)
|
|
{
|
|
$this->data = $data;
|
|
}
|
|
|
|
public function hasField(string $fieldName): bool
|
|
{
|
|
return isset($this->data[$fieldName]);
|
|
}
|
|
|
|
public function getField(string $fieldName): mixed
|
|
{
|
|
return isset($this->data[$fieldName]) ?: null;
|
|
}
|
|
|
|
public function getSomething()
|
|
{
|
|
return 'something';
|
|
}
|
|
}
|