public function postSave(PropelPDO $con = null) { if ($this->roleIdsChanged) { // delete old roles $c = new Criteria(); $c->addAnd(KuserToUserRolePeer::KUSER_ID, $this->getId(), Criteria::EQUAL); KuserToUserRolePeer::doDelete($c); // add new roles $idsArray = explode(',', $this->roleIds); foreach ($idsArray as $id) { if (!is_null($id) && $id != '') { $kuserToRole = new KuserToUserRole(); $kuserToRole->setUserRoleId($id); $kuserToRole->setKuserId($this->getId()); $kuserToRole->save(); } } } $this->roleIdsChanged = false; //update all categoryKuser object with kuser if (categoryKuserPeer::isCategroyKuserExistsForKuser($this->getId())) { $featureStatusToRemoveIndex = new kFeatureStatus(); $featureStatusToRemoveIndex->setType(IndexObjectType::CATEGORY_USER); $featureStatusesToRemove = array(); $featureStatusesToRemove[] = $featureStatusToRemoveIndex; $filter = new categoryKuserFilter(); $filter->setUserIdEqual($this->getPuserId()); kJobsManager::addIndexJob($this->getPartnerId(), IndexObjectType::CATEGORY_USER, $filter, true, $featureStatusesToRemove); } return parent::postSave(); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param KuserToUserRole $value A KuserToUserRole object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(KuserToUserRole $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } // if key === null self::$instances[$key] = $obj; } }
public function postSave(PropelPDO $con = null) { if ($this->roleIdsChanged) { // delete old roles $c = new Criteria(); $c->addAnd(KuserToUserRolePeer::KUSER_ID, $this->getId(), Criteria::EQUAL); KuserToUserRolePeer::doDelete($c); // add new roles $idsArray = explode(',', $this->roleIds); foreach ($idsArray as $id) { if (!is_null($id) && $id != '') { $kuserToRole = new KuserToUserRole(); $kuserToRole->setUserRoleId($id); $kuserToRole->setKuserId($this->getId()); $kuserToRole->save(); } } } $this->roleIdsChanged = false; //update all categoryKuser object with kuser //TODO - need to check if kuser needs to add job return parent::postSave(); }
/** * Adds an object to the instance pool. * * Propel keeps cached copies of objects in an instance pool when they are retrieved * from the database. In some cases -- especially when you override doSelect*() * methods in your stub classes -- you may need to explicitly add objects * to the cache in order to ensure that the same objects are always returned by doSelect*() * and retrieveByPK*() calls. * * @param KuserToUserRole $value A KuserToUserRole object. * @param string $key (optional) key to use for instance map (for performance boost if key was already calculated externally). */ public static function addInstanceToPool(KuserToUserRole $obj, $key = null) { if (Propel::isInstancePoolingEnabled()) { if ($key === null) { $key = (string) $obj->getId(); } if (isset(self::$instances[$key]) || count(self::$instances) < kConf::get('max_num_instances_in_pool')) { self::$instances[$key] = $obj; kMemoryManager::registerPeer('KuserToUserRolePeer'); } } }