本文整理汇总了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());
}
}