/magento/app/code/core/Mage/Customer/Model/Api2/Customer/Rest/Admin/V1.php
PHP | 75 lines | 27 code | 5 blank | 43 comment | 2 complexity | 3156d49d0dc07bc1149484e09e91ddf1 MD5 | raw file
Possible License(s): LGPL-3.0
- <?php
- /**
- * Magento
- *
- * NOTICE OF LICENSE
- *
- * This source file is subject to the Open Software License (OSL 3.0)
- * that is bundled with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://opensource.org/licenses/osl-3.0.php
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@magentocommerce.com so we can send you a copy immediately.
- *
- * DISCLAIMER
- *
- * Do not edit or add to this file if you wish to upgrade Magento to newer
- * versions in the future. If you wish to customize Magento for your
- * needs please refer to http://www.magentocommerce.com for more information.
- *
- * @category Mage
- * @package Mage_Customer
- * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
- * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
- */
- /**
- * API2 class for customer (admin)
- *
- * @category Mage
- * @package Mage_Customer
- * @author Magento Core Team <core@magentocommerce.com>
- */
- class Mage_Customer_Model_Api2_Customer_Rest_Admin_V1 extends Mage_Customer_Model_Api2_Customer_Rest
- {
- /**
- * Retrieve information about customer
- * Add last logged in datetime
- *
- * @throws Mage_Api2_Exception
- * @return array
- */
- protected function _retrieve()
- {
- /** @var $log Mage_Log_Model_Customer */
- $log = Mage::getModel('log/customer');
- $log->loadByCustomer($this->getRequest()->getParam('id'));
- $data = parent::_retrieve();
- $data['is_confirmed'] = (int) !(isset($data['confirmation']) && $data['confirmation']);
- $lastLoginAt = $log->getLoginAt();
- if (null !== $lastLoginAt) {
- $data['last_logged_in'] = $lastLoginAt;
- }
- return $data;
- }
- /**
- * Delete customer
- */
- protected function _delete()
- {
- /** @var $customer Mage_Customer_Model_Customer */
- $customer = parent::_loadCustomerById($this->getRequest()->getParam('id'));
- try {
- $customer->delete();
- } catch (Mage_Core_Exception $e) {
- $this->_critical($e->getMessage(), Mage_Api2_Model_Server::HTTP_INTERNAL_ERROR);
- } catch (Exception $e) {
- $this->_critical(self::RESOURCE_INTERNAL_ERROR);
- }
- }
- }