Exemplo n.º 1
0
 /**
  * Constructs a new placeholder class and use the object to fill
  * the placeholder with.
  * 
  * @param unknown $object
  */
 public function __construct($object, $begin = "<<", $end = ">>")
 {
     $replace = array();
     if ($object instanceof Part) {
         $replace = array('id' => $object->getId(), 'barcodeId' => $object->getId() * 10 + 1, 'name' => $object->getName(), 'internalNumber' => $object->getInternalPartNumber(), 'description' => $object->getDescription(), 'categoryFull' => $object->getCategory()->getCategoryPath(), 'categoryLast' => $object->getCategory()->getName(), 'footprintName' => $object->getFootprint() === null ? '' : $object->getFootprint()->getName(), 'storageLocationName' => $object->getStorageLocation() === null ? '' : $object->getStorageLocation()->getName());
     } else {
         if ($object instanceof StorageLocation) {
             $replace = array('id' => $object->getId(), 'barcodeId' => $object->getId() * 10 + 2, 'name' => $object->getName());
         }
     }
     $this->beginToken = $begin;
     $this->endToken = $end;
     $this->replacements = $replace;
 }
Exemplo n.º 2
0
 /**
  * Catch category data before category save
  * @param unknown $observer
  */
 public function categorySaveBefore($observer)
 {
     if ($this->autoIndex) {
         $categoryId = $observer->getCategory()->getId();
         $this->data['save_category_id'] = $categoryId;
     }
 }