本文整理汇总了PHP中Tinebase_Record_Abstract::convertId方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_Abstract::convertId方法的具体用法?PHP Tinebase_Record_Abstract::convertId怎么用?PHP Tinebase_Record_Abstract::convertId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Record_Abstract
的用法示例。
在下文中一共展示了Tinebase_Record_Abstract::convertId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* get by id
* - results are cached
*
* @param string $_id the id of the peer
* @return Voipmanager_Model_Snom_Location
*/
public function get($_id)
{
$id = Tinebase_Record_Abstract::convertId($_id, $this->_modelName);
if ($this->_cacheIdPrefix && $this->_cache) {
$cacheId = $this->_cacheIdPrefix . $id;
if ($this->_cache->test($id)) {
$result = $this->_cache->load($id);
} else {
$result = $this->_backend->get($id);
$this->_cache->save($result, $cacheId, array($this->_cacheIdPrefix), 5);
}
} else {
$result = $this->_backend->get($id);
}
return $result;
}
示例2: _getUpdates
/**
* get updates of human interest
*
* @param Calendar_Model_Event $_event
* @param Calendar_Model_Event $_oldEvent
* @return array
*/
protected function _getUpdates($_event, $_oldEvent)
{
// check event details
$diff = $_event->diff($_oldEvent)->diff;
$orderedUpdateFieldOfInterest = array('dtstart', 'dtend', 'rrule', 'summary', 'location', 'description', 'transp', 'priority', 'status', 'class', 'url', 'is_all_day_event', 'originator_tz');
$updates = array();
foreach ($orderedUpdateFieldOfInterest as $field) {
if (isset($diff[$field]) || array_key_exists($field, $diff)) {
$updates[$field] = $diff[$field];
}
}
// rrule legacy
if (isset($updates['rrule']) || array_key_exists('rrule', $updates)) {
$updates['rrule'] = $_oldEvent->rrule;
}
// check for organizer update
if (Tinebase_Record_Abstract::convertId($_event['organizer'], 'Addressbook_Model_Contact') != Tinebase_Record_Abstract::convertId($_oldEvent['organizer'], 'Addressbook_Model_Contact')) {
$updates['organizer'] = $_event->resolveOrganizer();
}
// check attendee updates
$attendeeMigration = Calendar_Model_Attender::getMigration($_oldEvent->attendee, $_event->attendee);
foreach ($attendeeMigration['toUpdate'] as $attendee) {
$oldAttendee = Calendar_Model_Attender::getAttendee($_oldEvent->attendee, $attendee);
if ($attendee->status == $oldAttendee->status) {
$attendeeMigration['toUpdate']->removeRecord($attendee);
}
}
foreach ($attendeeMigration as $action => $migration) {
Calendar_Model_Attender::resolveAttendee($migration, FALSE);
if (!count($migration)) {
unset($attendeeMigration[$action]);
}
}
if (!empty($attendeeMigration)) {
$updates['attendee'] = $attendeeMigration;
}
return $updates;
}
示例3: getMemberships
/**
* get group memberships of contact id
*
* @param mixed $contactId
* @return array
*/
public function getMemberships($contactId)
{
$contactId = Tinebase_Record_Abstract::convertId($contactId, 'Addressbook_Model_Contact');
$select = $this->_db->select()->from($this->_tablePrefix . $this->_foreignTables['members']['table'], 'list_id')->where($this->_db->quoteIdentifier('contact_id') . ' = ?', $contactId);
$stmt = $this->_db->query($select);
$rows = (array) $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
$result = array();
foreach ($rows as $membership) {
$result[] = $membership['list_id'];
}
return $result;
}
示例4: delete
/**
* Deletes entries
*
* @param string|integer|Tinebase_Record_Interface|array $_id
* @return int The number of affected rows.
*/
public function delete($_id)
{
if (empty($_id)) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' No records deleted.');
}
return 0;
}
$idArray = !is_array($_id) ? array(Tinebase_Record_Abstract::convertId($_id, $this->_modelName)) : $_id;
$identifier = $this->_getRecordIdentifier();
$where = array($this->_db->quoteInto($this->_db->quoteIdentifier($identifier) . ' IN (?)', $idArray));
return $this->_db->delete($this->_tablePrefix . $this->_tableName, $where);
}
示例5: _getRedirect
/**
* get redirects by sippeer_id
*
* @param string|Voipmanager_Model_Asterisk_SipPeer $_sipPeer the sippeer id|object
* @return Voipmanager_Model_Asterisk_Redirect
*
* @throws Voipmanager_Exception_NotFound
*/
protected function _getRedirect($_sipPeer)
{
$sipPeerId = Tinebase_Record_Abstract::convertId($_sipPeer, 'Voipmanager_Model_Asterisk_SipPeer');
$filter = new Voipmanager_Model_Asterisk_RedirectFilter(array(array('field' => 'sippeer_id', 'operator' => 'equals', 'value' => $sipPeerId)));
$redirects = Voipmanager_Controller_Asterisk_Redirect::getInstance()->search($filter);
if (count($redirects) === 0) {
throw new Voipmanager_Exception_NotFound();
}
return $redirects[0];
}