forked from gvlawrence/comp356-mac15
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CollectionTree.php
40 lines (37 loc) · 1.09 KB
/
CollectionTree.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Collection Tree
*
* @copyright Copyright 2007-2012 Roy Rosenzweig Center for History and New Media
* @license http://www.gnu.org/licenses/gpl-3.0.txt GNU GPLv3
*/
/**
* A collection_trees row.
*
* @package Omeka\Plugins\CollectionTree
*/
class CollectionTree extends Omeka_Record_AbstractRecord
{
public $parent_collection_id;
public $collection_id;
public $name;
/**
* Validate the record.
*/
protected function _validate()
{
if ($this->collection_id == $this->parent_collection_id) {
$this->addError(
__('Parent Collection'),
__('A collection cannot be a parent to itself.')
);
}
$unassignableCollectionIds = $this->getTable()->getUnassignableCollectionIds($this->collection_id);
if (in_array($this->parent_collection_id, $unassignableCollectionIds)) {
$this->addError(
__('Parent Collection'),
__('A collection cannot be assigned to a collection in its descendant tree.')
);
}
}
}