本文整理汇总了PHP中entryPeer::doDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP entryPeer::doDelete方法的具体用法?PHP entryPeer::doDelete怎么用?PHP entryPeer::doDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类entryPeer
的用法示例。
在下文中一共展示了entryPeer::doDelete方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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(entryPeer::DATABASE_NAME, Propel::CONNECTION_WRITE);
}
$con->beginTransaction();
try {
$ret = $this->preDelete($con);
if ($ret) {
entryPeer::doDelete($this, $con);
$this->postDelete($con);
$this->setDeleted(true);
$con->commit();
} else {
$con->commit();
}
} catch (PropelException $e) {
$con->rollBack();
throw $e;
}
}
示例2: execute
/**
*
select kshow.id,concat('http://www.kaltura.com/index.php/browse/bands?band_id=',indexed_custom_data_1),concat('http://profile.myspace.com/index.cfm?fuseaction=user.viewpr
ofile&friendID=',indexed_custom_data_1) , kuser.screen_name , indexed_custom_data_1 from kshow ,kuser where kshow.partner_id=5 AND kuser.id=kshow.producer_id AND kshow.
id>=10815 order by kshow.id ;
~
*/
public function execute()
{
$this->forceSystemAuthentication();
$kshow_id = $this->getRequestParameter("kshow_id", null);
$band_id = $this->getRequestParameter("band_id", null);
$kuser_name = $this->getRequestParameter("kuser_name", null);
$this->other_kshows_by_producer = null;
$error = "";
$kshow = null;
$kuser = null;
$entries = null;
$this->kuser_count = 0;
$should_delete = $this->getRequestParameter("deleteme", "false") == "true";
if ($kuser_name) {
$c = new Criteria();
$c->add(kuserPeer::SCREEN_NAME, "%" . $kuser_name . "%", Criteria::LIKE);
$this->kuser_count = kuserPeer::doCount($c);
$kuser = kuserPeer::doSelectOne($c);
if ($kuser) {
$this->other_kshows_by_producer = $this->getKshowsForKuser($kuser, null);
} else {
$error .= "Cannot find kuser with name [{$kuser_name}]<br>";
}
$other_kshow_count = count($this->other_kshows_by_producer);
if ($other_kshow_count < 1) {
// kuser has no kshow - delete him !
if ($should_delete) {
$kuser->delete();
}
} else {
if ($other_kshow_count == 1) {
$kshow_id = $this->other_kshows_by_producer[0]->getId();
} else {
// kuser has more than one kshow - let user choose
$error .= "[{$kuser_name}] has ({$other_kshow_count}) shows.<br>";
}
}
}
if ($band_id) {
$c = new Criteria();
$c->add(kshowPeer::INDEXED_CUSTOM_DATA_1, $band_id);
$c->add(kshowPeer::PARTNER_ID, 5);
$kshow = kshowPeer::doSelectOne($c);
} else {
if ($kshow_id) {
$kshow = kshowPeer::retrieveByPK($kshow_id);
}
}
if ($kshow) {
if (!$kuser) {
$kuser = kuserPeer::retrieveByPK($kshow->getProducerId());
}
if ($kuser) {
$this->other_kshows_by_producer = $this->getKshowsForKuser($kuser, $kshow);
if ($should_delete) {
if (count($this->other_kshows_by_producer) == 0) {
$kuser->delete();
}
}
}
$entries = $kshow->getEntrys();
if ($should_delete) {
$id_list = array();
foreach ($entries as $entry) {
$id_list[] = $entry->getId();
}
if ($id_list) {
$d = new Criteria();
$d->add(entryPeer::ID, $id_list, Criteria::IN);
entryPeer::doDelete($d);
}
}
if ($should_delete) {
$kshow->delete();
}
} else {
$error .= "Cannot find kshow [{$kshow_id}]<br>";
}
$this->kshow_id = $kshow_id;
$this->kuser_name = $kuser_name;
$this->kshow = $kshow;
$this->kuser = $kuser;
$this->entries = $entries;
$this->should_delete = $should_delete;
$this->error = $error;
}