summaryrefslogtreecommitdiffstats
path: root/lib/model/DomainPeer.php
blob: f4c06f3ff8a73332e5caafb233fdf6b96716bb72 (plain)
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
41
42
43
44
45
46
47
<?php

/**
 * Subclass for performing query and update operations on the 'domain' table.
 *
 * 
 *
 * @package lib.model
 */ 
class DomainPeer extends BaseDomainPeer
{
	// only return results according to domain permissions
	public static function doCount(Criteria $criteria, $distinct = false, $con = null)
	{
		DomainPermissionPeer::addDomainPermissionCriteria($criteria, DomainPeer::ID);
		return parent::doCount($criteria, $distinct, $con);
	}
	
	public static function doSelect(Criteria $criteria, $con = null)
	{
		DomainPermissionPeer::addDomainPermissionCriteria($criteria, DomainPeer::ID);
		return parent::doSelect($criteria, $con);
	}

	public static function doSelectJoinUser(Criteria $criteria, $con = null)
	{
		DomainPermissionPeer::addDomainPermissionCriteria($criteria, DomainPeer::ID);
		return parent::doSelectJoinUser($criteria, $con);
	}

	protected static function doOnDeleteCascade(Criteria $criteria, Connection $con)
	{
		// cloning the Criteria in case it's modified by doSelect() or doSelectStmt()
		if ($criteria instanceof Criteria) {
			$c = clone $criteria;
		}

		return parent::doOnDeleteCascade($c, $con);
	}

	public static function getDomainByName($name)
	{
		$c = new Criteria();
		$c->add(self::NAME, $name);
		return self::doSelect($c);
	}
}