本文整理汇总了PHP中Mage_Core_Model_Abstract::getRoleId方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Model_Abstract::getRoleId方法的具体用法?PHP Mage_Core_Model_Abstract::getRoleId怎么用?PHP Mage_Core_Model_Abstract::getRoleId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Model_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Model_Abstract::getRoleId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _beforeSave
protected function _beforeSave(Mage_Core_Model_Abstract $object)
{
/** @var Mirasvit_Helpdesk_Model_Permission $object */
if (!$object->getId()) {
$object->setCreatedAt(Mage::getSingleton('core/date')->gmtDate());
}
if (!$object->getRoleId()) {
$object->setRoleId(new Zend_Db_Expr('NULL'));
}
$object->setUpdatedAt(Mage::getSingleton('core/date')->gmtDate());
return parent::_beforeSave($object);
}
示例2: roleUserExists
/**
* Check if role user exists
*
* @param Mage_Core_Model_Abstract $user
* @return array|false
*/
public function roleUserExists(Mage_Core_Model_Abstract $user)
{
if ($user->getUserId() > 0) {
$roleTable = $this->getTable('admin/role');
$dbh = $this->_getReadAdapter();
$binds = array('parent_id' => $user->getRoleId(), 'user_id' => $user->getUserId());
$select = $dbh->select()->from($roleTable)->where('parent_id = :parent_id')->where('user_id = :user_id');
return $dbh->fetchCol($select, $binds);
} else {
return array();
}
}
示例3: roleUserExists
public function roleUserExists(Mage_Core_Model_Abstract $user)
{
if ($user->getUserId() > 0) {
$roleTable = $this->getTable('api/role');
$dbh = $this->_getReadAdapter();
$select = $dbh->select()->from($roleTable)->where("parent_id = {$user->getRoleId()} AND user_id = {$user->getUserId()}");
return $dbh->fetchCol($select);
} else {
return array();
}
}
示例4: roleUserExists
/**
* Retrieve roles which exists for user
*
* @param Mage_Core_Model_Abstract $user
* @return array
*/
public function roleUserExists(Mage_Core_Model_Abstract $user)
{
$result = array();
if ($user->getUserId() > 0) {
$adapter = $this->_getReadAdapter();
$select = $adapter->select()->from($this->getTable('api/role'))->where('parent_id = ?', $user->getRoleId())->where('user_id = ?', $user->getUserId());
$result = $adapter->fetchCol($select);
}
return $result;
}