Esempio n. 1
0
	final static function getByID($peID) {
		$obj = Cache::get('permission_access_entity', $peID);
		if ($obj instanceof PermissionAccessEntity) {
			return $obj;
		}
		$db = Loader::db();
		$r = $db->GetRow('select petID, peID from PermissionAccessEntities where peID = ?', array($peID));
		if (is_array($r)) {
			$pt = PermissionAccessEntityType::getByID($r['petID']);
			$class = Loader::helper('text')->camelcase($pt->getAccessEntityTypeHandle());
			$class .= 'PermissionAccessEntity';
			$obj = new $class();
			$r['petHandle'] = $pt->getAccessEntityTypeHandle();
			$obj->setPropertiesFromArray($r);
			$obj->load();
		}
		Cache::set('permission_access_entity', $peID, $obj);
		return $obj;
	}
Esempio n. 2
0
 public static function add($petHandle, $petName, $pkg = false)
 {
     $pkgID = 0;
     if (is_object($pkg)) {
         $pkgID = $pkg->getPackageID();
     }
     $db = Loader::db();
     $db->Execute('insert into PermissionAccessEntityTypes (petHandle, petName, pkgID) values (?, ?, ?)', array($petHandle, $petName, $pkgID));
     $id = $db->Insert_ID();
     $est = PermissionAccessEntityType::getByID($id);
     return $est;
 }