silverstripe-frameworktest/code/tagfield/TestTag.php

25 lines
480 B
PHP
Raw Normal View History

<?php
2013-04-06 13:44:13 +02:00
if(class_exists('TagField')) {
class TestTag extends DataObject {
private static $db = array(
'Title' => 'Text'
);
private static $belongs_many_many = array(
'Pages' => 'TestTagFieldPage'
);
function requireDefaultRecords(){
$class = $this->class;
if(!DataObject::get_one($class)) {
foreach(array('one', 'two', 'three', 'four') as $title) {
$tag = new $class();
$tag->Title = $title;
$tag->write();
}
}
}
}
}