File indexing completed on 2024-06-23 05:51:18
0001 <?php 0002 0003 /** 0004 * ocs-webserver 0005 * 0006 * Copyright 2016 by pling GmbH. 0007 * 0008 * This file is part of ocs-webserver. 0009 * 0010 * This program is free software: you can redistribute it and/or modify 0011 * it under the terms of the GNU Affero General Public License as 0012 * published by the Free Software Foundation, either version 3 of the 0013 * License, or (at your option) any later version. 0014 * 0015 * This program is distributed in the hope that it will be useful, 0016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0018 * GNU Affero General Public License for more details. 0019 * 0020 * You should have received a copy of the GNU Affero General Public License 0021 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0022 **/ 0023 class Backend_Commands_DeleteProductFromIndex implements Local_Queue_CommandInterface 0024 { 0025 0026 protected $productId; 0027 protected $catId; 0028 0029 /** 0030 * PHP 5 allows developers to declare constructor methods for classes. 0031 * Classes which have a constructor method call this method on each newly-created object, 0032 * so it is suitable for any initialization that the object may need before it is used. 0033 * 0034 * Note: Parent constructors are not called implicitly if the child class defines a constructor. 0035 * In order to run a parent constructor, a call to parent::__construct() within the child constructor is required. 0036 * 0037 * param [ mixed $args [, $... ]] 0038 * 0039 * @param int $productId 0040 * 0041 * @link http://php.net/manual/en/language.oop5.decon.php 0042 */ 0043 public function __construct($productId, $catId) 0044 { 0045 $this->productId = $productId; 0046 $this->catId = $catId; 0047 } 0048 0049 0050 public function doCommand() 0051 { 0052 return $this->deleteProductFromIndex(); 0053 } 0054 0055 protected function deleteProductFromIndex() 0056 { 0057 if (empty($this->productId) OR empty($this->catId)) { 0058 Zend_Registry::get('logger')->warn(__METHOD__ . ' - no productId or catId was set.'); 0059 return; 0060 } 0061 0062 $product = array(); 0063 $product['project_id'] = $this->productId; 0064 $product['project_category_id'] = $this->catId; 0065 0066 $modelSearch = new Default_Model_Search_Lucene(); 0067 $modelSearch->deleteDocument($product); 0068 } 0069 0070 }