本文整理汇总了PHP中UserPeer::doDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP UserPeer::doDelete方法的具体用法?PHP UserPeer::doDelete怎么用?PHP UserPeer::doDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserPeer
的用法示例。
在下文中一共展示了UserPeer::doDelete方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(UserPeer::DATABASE_NAME);
}
try {
$con->begin();
UserPeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollback();
throw $e;
}
}
示例2: import
public function import($adminUserId)
{
$count = 0;
$add_method = $this->getValue('add_method');
$file = $this->getValue('file');
$delimiter = $this->getValue('delimiter');
$skipHeader = $this->getValue('skipHeader');
$fp = fopen($file->getTempName(), 'r');
if ($fp) {
if ($add_method == self::REPLACE) {
$c = new Criteria();
$c->add(UserPeer::ID, $adminUserId, Criteria::NOT_EQUAL);
UserPeer::doDelete($c);
}
while ($data = fgetcsv($fp, 0, $delimiter)) {
if (empty($data[0]) || count($data) < 7) {
continue;
}
if ($skipHeader) {
$skipHeader = false;
continue;
}
try {
$user = new User();
$user->setFamilyName($data[0]);
$user->setSurname($data[1]);
$user->setBirthdate($data[2]);
$user->setCardNumber($data[3]);
$user->setEmailAddress($data[4]);
$user->setAddress($data[5]);
$user->setPhoneNumber($data[6]);
$user->autoCorrectNames();
$user->autoSetLogin();
$user->save();
++$count;
} catch (Exception $ex) {
}
}
fclose($fp);
return $count;
}
return false;
}
示例3: doOnDeleteCascade
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = RolePeer::doSelect($criteria, $con);
foreach ($objects as $obj) {
// delete related Employee objects
$c = new Criteria(EmployeePeer::DATABASE_NAME);
$c->add(EmployeePeer::ROLE_ID, $obj->getId());
$affectedRows += EmployeePeer::doDelete($c, $con);
// delete related User objects
$c = new Criteria(UserPeer::DATABASE_NAME);
$c->add(UserPeer::ROLE_ID, $obj->getId());
$affectedRows += UserPeer::doDelete($c, $con);
}
return $affectedRows;
}
示例4: delete
/**
* Removes this object from datastore and sets delete attribute.
*
* @param PropelPDO $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete(PropelPDO $con = null)
{
foreach (sfMixer::getCallables('BaseUser:delete:pre') as $callable) {
$ret = call_user_func($callable, $this, $con);
if ($ret) {
return;
}
}
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(UserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
UserPeer::doDelete($this, $con);
$this->setDeleted(true);
$con->commit();
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
foreach (sfMixer::getCallables('BaseUser:delete:post') as $callable) {
call_user_func($callable, $this, $con);
}
}
示例5: doOnDeleteCascade
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = sfGuardUserPeer::doSelect($criteria, $con);
foreach ($objects as $obj) {
// delete related sfGuardUserPermission objects
$criteria = new Criteria(sfGuardUserPermissionPeer::DATABASE_NAME);
$criteria->add(sfGuardUserPermissionPeer::USER_ID, $obj->getId());
$affectedRows += sfGuardUserPermissionPeer::doDelete($criteria, $con);
// delete related sfGuardUserGroup objects
$criteria = new Criteria(sfGuardUserGroupPeer::DATABASE_NAME);
$criteria->add(sfGuardUserGroupPeer::USER_ID, $obj->getId());
$affectedRows += sfGuardUserGroupPeer::doDelete($criteria, $con);
// delete related sfGuardRememberKey objects
$criteria = new Criteria(sfGuardRememberKeyPeer::DATABASE_NAME);
$criteria->add(sfGuardRememberKeyPeer::USER_ID, $obj->getId());
$affectedRows += sfGuardRememberKeyPeer::doDelete($criteria, $con);
// delete related User objects
$criteria = new Criteria(UserPeer::DATABASE_NAME);
$criteria->add(UserPeer::SF_GUARD_USER_ID, $obj->getId());
$affectedRows += UserPeer::doDelete($criteria, $con);
}
return $affectedRows;
}
示例6: doOnDeleteCascade
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = AccountPeer::doSelect($criteria, $con);
foreach ($objects as $obj) {
// delete related BookingType objects
$criteria = new Criteria(BookingTypePeer::DATABASE_NAME);
$criteria->add(BookingTypePeer::ACCOUNT_ID, $obj->getId());
$affectedRows += BookingTypePeer::doDelete($criteria, $con);
// delete related ClockingType objects
$criteria = new Criteria(ClockingTypePeer::DATABASE_NAME);
$criteria->add(ClockingTypePeer::ACCOUNT_ID, $obj->getId());
$affectedRows += ClockingTypePeer::doDelete($criteria, $con);
// delete related Domain objects
$criteria = new Criteria(DomainPeer::DATABASE_NAME);
$criteria->add(DomainPeer::ACCOUNT_ID, $obj->getId());
$affectedRows += DomainPeer::doDelete($criteria, $con);
// delete related Holiday objects
$criteria = new Criteria(HolidayPeer::DATABASE_NAME);
$criteria->add(HolidayPeer::ACCOUNT_ID, $obj->getId());
$affectedRows += HolidayPeer::doDelete($criteria, $con);
// delete related Plugin objects
$criteria = new Criteria(PluginPeer::DATABASE_NAME);
$criteria->add(PluginPeer::ACCOUNT_ID, $obj->getId());
$affectedRows += PluginPeer::doDelete($criteria, $con);
// delete related Property objects
$criteria = new Criteria(PropertyPeer::DATABASE_NAME);
$criteria->add(PropertyPeer::ACCOUNT_ID, $obj->getId());
$affectedRows += PropertyPeer::doDelete($criteria, $con);
// delete related User objects
$criteria = new Criteria(UserPeer::DATABASE_NAME);
$criteria->add(UserPeer::ACCOUNT_ID, $obj->getId());
$affectedRows += UserPeer::doDelete($criteria, $con);
}
return $affectedRows;
}
示例7: doOnDeleteCascade
/**
* This is a method for emulating ON DELETE CASCADE for DBs that don't support this
* feature (like MySQL or SQLite).
*
* This method is not very speedy because it must perform a query first to get
* the implicated records and then perform the deletes by calling those Peer classes.
*
* This method should be used within a transaction if possible.
*
* @param Criteria $criteria
* @param PropelPDO $con
* @return int The number of affected rows (if supported by underlying database driver).
*/
protected static function doOnDeleteCascade(Criteria $criteria, PropelPDO $con)
{
// initialize var to track total num of affected rows
$affectedRows = 0;
// first find the objects that are implicated by the $criteria
$objects = DomainPeer::doSelect($criteria, $con);
foreach ($objects as $obj) {
// delete related HolidayDomain objects
$criteria = new Criteria(HolidayDomainPeer::DATABASE_NAME);
$criteria->add(HolidayDomainPeer::DOMAIN_ID, $obj->getId());
$affectedRows += HolidayDomainPeer::doDelete($criteria, $con);
// delete related PropertyValue objects
$criteria = new Criteria(PropertyValuePeer::DATABASE_NAME);
$criteria->add(PropertyValuePeer::DOMAIN_ID, $obj->getId());
$affectedRows += PropertyValuePeer::doDelete($criteria, $con);
// delete related User objects
$criteria = new Criteria(UserPeer::DATABASE_NAME);
$criteria->add(UserPeer::DOMAIN_ID, $obj->getId());
$affectedRows += UserPeer::doDelete($criteria, $con);
}
return $affectedRows;
}
示例8: delete
/**
* Removes this object from datastore and sets delete attribute.
*
* @param PropelPDO $con
* @return void
* @throws PropelException
* @see BaseObject::setDeleted()
* @see BaseObject::isDeleted()
*/
public function delete(PropelPDO $con = null)
{
if ($this->isDeleted()) {
throw new PropelException("This object has already been deleted.");
}
if ($con === null) {
$con = Propel::getConnection(UserPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
UserPeer::doDelete($this, $con);
$this->postDelete($con);
$this->setDeleted(true);
$con->commit();
} else {
$con->commit();
}
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
示例9: listDelete
public function listDelete()
{
$criteria = new Criteria();
$criteria->add(UserPeer::ID, $this->getId());
$criteria->add(FtpAccountPeer::USER_ID, $this->getId());
$criteria->add(SambaAccountPeer::USER_ID, $this->getId());
$criteria->add(UnixAccountPeer::USER_ID, $this->getId());
$criteria->add(UserIdentificationPeer::USER_ID, $this->getId());
UserPeer::doDelete($criteria);
//return true;
}