silverstripe-framework/tests/php/Dev/Validation/Team.php

62 lines
1.4 KiB
PHP

<?php
namespace SilverStripe\Dev\Tests\Validation;
use SilverStripe\Dev\TestOnly;
use SilverStripe\ORM\DataObject;
use SilverStripe\ORM\DataObjectSchema;
use SilverStripe\ORM\HasManyList;
use SilverStripe\ORM\ManyManyList;
use SilverStripe\ORM\ManyManyThroughList;
/**
* Class Team
*
* @property string $Title
* @method HasManyList|Member[] Members()
* @method HasManyList|Freelancer[] FreelancerMembers()
* @method ManyManyThroughList|Member[] Freelancers()
* @method ManyManyList|Hat[] ReserveHats()
*/
class Team extends DataObject implements TestOnly
{
/**
* @var string
*/
private static $table_name = 'RelationValidationTest_Team';
/**
* @var array
*/
private static $db = [
'Title' => 'Varchar(255)',
];
private static array $has_one = [
'SingleMember' => [
'class' => DataObject::class,
DataObjectSchema::HAS_ONE_MULTI_RELATIONAL => true,
],
];
/**
* @var array
*/
private static $has_many = [
'Members' => Member::class . '.HomeTeam',
'FreelancerMembers' => Freelancer::class . '.TemporaryTeam',
];
/**
* @var array
*/
private static $many_many = [
'ReserveHats' => Hat::class,
'Freelancers' => [
'through' => Freelancer::class,
'from' => 'TemporaryTeam',
'to' => 'TemporaryMember',
],
];
}