本文整理匯總了PHP中ContentPeer::retrieveByPK方法的典型用法代碼示例。如果您正苦於以下問題:PHP ContentPeer::retrieveByPK方法的具體用法?PHP ContentPeer::retrieveByPK怎麽用?PHP ContentPeer::retrieveByPK使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ContentPeer
的用法示例。
在下文中一共展示了ContentPeer::retrieveByPK方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: deleteContent
function deleteContent($data, $fields)
{
$obj = new Content();
$ConCategory = $fields['CON_CATEGORY'];
$ConParent = $fields['CON_PARENT'];
$ConId = $fields['CON_ID'];
$ConLang = $fields['CON_LANG'];
try {
//$res = $obj->load($ConCategory, $ConParent, $ConId, $ConLang );
$content = ContentPeer::retrieveByPK($ConCategory, $ConParent, $ConId, $ConLang);
if ($content) {
$content->delete();
}
} catch (Exception $e) {
return $e;
}
return $res;
}
示例2: removeLanguageContent
function removeLanguageContent($lanId)
{
try {
$c = new Criteria();
$c->addSelectColumn(ContentPeer::CON_CATEGORY);
$c->addSelectColumn(ContentPeer::CON_PARENT);
$c->addSelectColumn(ContentPeer::CON_ID);
$c->addSelectColumn(ContentPeer::CON_LANG);
$c->add(ContentPeer::CON_LANG, $lanId);
$result = ContentPeer::doSelectRS($c);
$result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$result->next();
$row = $result->getRow();
while (is_array($row)) {
$content = ContentPeer::retrieveByPK($row['CON_CATEGORY'], '', $row['CON_ID'], $lanId);
if ($content !== null) {
$content->delete();
}
$result->next();
$row = $result->getRow();
}
} catch (Exception $e) {
throw $e;
}
}
示例3: delete
/**
* Implementation for 'DELETE' method for Rest API
*
* @param mixed $conCategory, $conParent, $conId, $conLang Primary key
*
* @return array $result Returns array within multiple records or a single record depending if
* a single selection was requested passing id(s) as param
*/
protected function delete($conCategory, $conParent, $conId, $conLang)
{
$conn = Propel::getConnection(ContentPeer::DATABASE_NAME);
try {
$conn->begin();
$obj = ContentPeer::retrieveByPK($conCategory, $conParent, $conId, $conLang);
if (!is_object($obj)) {
throw new RestException(412, G::LoadTranslation('ID_RECORD_DOES_NOT_EXIST'));
}
$obj->delete();
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw new RestException(412, $e->getMessage());
}
}
示例4: updateInsertContent
public function updateInsertContent($content, $field, $value)
{
if (isset($content[$field]['en'])) {
//update
$con = ContentPeer::retrieveByPK($field, '', $this->getAppUid(), 'en');
$con->setConValue($value);
if ($con->validate()) {
$res = $con->save();
}
} else {
//insert
$con = new Content();
$con->setConCategory($field);
$con->setConParent('');
$con->setConId($this->getAppUid());
$con->setConLang('en');
$con->setConValue($value);
if ($con->validate()) {
$res = $con->save();
}
}
}
示例5: delete
/**
* Implementation for 'DELETE' method for Rest API
*
* @param mixed $conCategory, $conParent, $conId, $conLang Primary key
*
* @return array $result Returns array within multiple records or a single record depending if
* a single selection was requested passing id(s) as param
*/
protected function delete($conCategory, $conParent, $conId, $conLang)
{
$conn = Propel::getConnection(ContentPeer::DATABASE_NAME);
try {
$conn->begin();
$obj = ContentPeer::retrieveByPK($conCategory, $conParent, $conId, $conLang);
if (!is_object($obj)) {
throw new RestException(412, 'Record does not exist.');
}
$obj->delete();
$conn->commit();
} catch (Exception $e) {
$conn->rollback();
throw new RestException(412, $e->getMessage());
}
}