Gpf_Rpc_Action::getIds PHP Method

getIds() public method

public getIds ( )
        public function getIds()
        {
            if ($this->params->exists(self::IDS)) {
                return new ArrayIterator($this->params->get(self::IDS));
            }
            if ($this->params->exists(self::IDS_REQUEST)) {
                return $this->getRequestIdsIterator();
            }
            throw new Gpf_Exception('No ids selected');
        }

Usage Example

コード例 #1
0
 /**
  *
  * @service export_file delete
  * @param Gpf_Rpc_Params $params
  * @return Gpf_Rpc_Action
  */
 public function deleteFiles(Gpf_Rpc_Params $params)
 {
     $action = new Gpf_Rpc_Action($params);
     $action->setInfoMessage($this->_("File(s) %s was successfully deleted"));
     $action->setErrorMessage($this->_("Could not delete %s file(s)"));
     foreach ($action->getIds() as $id) {
         try {
             $export = new Gpf_Db_Export();
             $export->setPrimaryKeyValue($id);
             $export->load();
             $fileName = $export->getFileName();
             $export->delete();
         } catch (Exception $e) {
             $action->addError();
             continue;
         }
         $filePath = Gpf_Paths::getInstance()->getAccountDirectoryPath() . Gpf_Csv_ImportExportService::EXPORT_DIRECTORY . $fileName;
         $file = new Gpf_Io_File($filePath);
         if ($file->isExists()) {
             if ($file->delete()) {
                 $action->addOk();
             } else {
                 $action->addError();
             }
         } else {
             $action->addOk();
         }
     }
     return $action;
 }
All Usage Examples Of Gpf_Rpc_Action::getIds