Ejemplo n.º 1
0
 /**
  * @param int $kuserId
  * @param int $kgroupId
  */
 public static function retrieveByKuserIdAndKgroupId($kuserId, $kgroupId)
 {
     $criteria = new Criteria();
     $criteria->add(KuserKgroupPeer::KUSER_ID, $kuserId);
     $criteria->add(KuserKgroupPeer::KGROUP_ID, $kgroupId);
     $criteria->add(KuserKgroupPeer::STATUS, KuserKgroupStatus::ACTIVE);
     return KuserKgroupPeer::doSelectOne($criteria);
 }
Ejemplo n.º 2
0
 protected function kuserDelete(kuser $kuser)
 {
     $filter = new categoryKuserFilter();
     $filter->setUserIdEqual($kuser->getPuserId());
     $c = new Criteria();
     $c->add(categoryKuserPeer::PUSER_ID, $kuser->getPuserId());
     if (categoryKuserPeer::doSelectOne($c)) {
         kJobsManager::addDeleteJob($kuser->getPartnerId(), DeleteObjectType::CATEGORY_USER, $filter);
     }
     if ($kuser->getType() == KuserType::USER) {
         // remove user from groups
         KuserKgroupPeer::deleteByKuserId($kuser->getId());
     } elseif ($kuser->getType() == KuserType::GROUP) {
         // remove users from group
         $filter = new KuserKgroupFilter();
         $filter->setGroupIdEqual($kuser->getPuserId());
         $c = new Criteria();
         $c->add(KuserKgroupPeer::PGROUP_ID, $kuser->getPuserId());
         if (KuserKgroupPeer::doSelectOne($c)) {
             kJobsManager::addDeleteJob($kuser->getPartnerId(), DeleteObjectType::GROUP_USER, $filter);
         }
     }
 }