mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
89c87ddbf8
* NEW: Static validation for relationships. * Unit tests added. * PR fixes * PR feedback: Execute validation on flush. * PR fixes. * PR fixes.
55 lines
1.1 KiB
PHP
55 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace SilverStripe\Dev\Tests\Validation;
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
|
use SilverStripe\ORM\DataObject;
|
|
use SilverStripe\ORM\HasManyList;
|
|
use SilverStripe\ORM\ManyManyThroughList;
|
|
|
|
/**
|
|
* Class Member
|
|
*
|
|
* @property string $Title
|
|
* @method Team HomeTeam()
|
|
* @method Hat Hat()
|
|
* @method HasManyList|Freelancer[] TemporaryMembers()
|
|
* @method ManyManyThroughList|Member[] FreelancerTeams()
|
|
*/
|
|
class Member extends DataObject implements TestOnly
|
|
{
|
|
/**
|
|
* @var string
|
|
*/
|
|
private static $table_name = 'RelationValidationTest_Member';
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private static $db = [
|
|
'Title' => 'Varchar(255)',
|
|
];
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private static $has_one = [
|
|
'HomeTeam' => Team::class,
|
|
'Hat' => Hat::class,
|
|
];
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private static $has_many = [
|
|
'TemporaryMembers' => Freelancer::class . '.TemporaryMember',
|
|
];
|
|
|
|
/**
|
|
* @var array
|
|
*/
|
|
private static $belongs_many_many = [
|
|
'FreelancerTeams' => Team::class . '.Freelancers',
|
|
];
|
|
}
|