/** Constructor. */ public function __construct() { parent::__construct(); $this->_name = 'oauth_token'; $this->_key = 'token_id'; $this->_mainData = array('token_id' => array('type' => MIDAS_DATA), 'token' => array('type' => MIDAS_DATA), 'scopes' => array('type' => MIDAS_DATA), 'client_id' => array('type' => MIDAS_DATA), 'user_id' => array('type' => MIDAS_DATA), 'creation_date' => array('type' => MIDAS_DATA), 'expiration_date' => array('type' => MIDAS_DATA), 'type' => array('type' => MIDAS_DATA), 'user' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'User', 'parent_column' => 'user_id', 'child_column' => 'user_id'), 'client' => array('type' => MIDAS_MANY_TO_ONE, 'model' => 'Client', 'module' => $this->moduleName, 'parent_column' => 'client_id', 'child_column' => 'client_id')); $this->initialize(); // required }
/** * Delete a client. Deletes all associated tokens and codes. * * @param Oauth_ClientDao $clientDao * @throws Zend_Exception */ public function delete($clientDao) { $tokens = $clientDao->getTokens(); /** @var Oauth_TokenModel $tokenModel */ $tokenModel = MidasLoader::loadModel('Token', 'oauth'); foreach ($tokens as $token) { $tokenModel->delete($token); } $tokens = null; $codes = $clientDao->getCodes(); /** @var Oauth_CodeModel $codeModel */ $codeModel = MidasLoader::loadModel('Code', 'oauth'); foreach ($codes as $code) { $codeModel->delete($code); } $codes = null; parent::delete($clientDao); }