Example #1
1
 /**
  * @param array $data
  * @return \Zend_Filter_Input
  * @throws \Exception
  */
 public function register(array $data)
 {
     $argv = compact('data');
     $results = \Pimcore::getEventManager()->triggerUntil('member.register.validate', $this, $argv, function ($v) {
         return $v instanceof \Zend_Filter_Input;
     });
     $input = $results->last();
     if (!$input instanceof \Zend_Filter_Input) {
         throw new \Exception('No validate listener attached to "member.register.validate" event');
     }
     if (!$input->isValid()) {
         return $input;
     }
     try {
         $this->setValues($input->getUnescaped());
         $this->setRole($this->getClass()->getFieldDefinition('role')->getDefaultValue());
         $this->setKey(str_replace('@', '_at_', $this->getEmail()));
         $this->setParent(Folder::getByPath('/' . ltrim(Config::get('auth')->adapter->objectPath, '/')));
         $this->save();
         \Pimcore::getEventManager()->trigger('member.register.post', $this);
     } catch (\Exception $e) {
         if ($this->getId()) {
             $this->delete();
         }
         throw $e;
     }
     return $input;
 }
Example #2
0
 /**
  * @param string $path
  */
 public function removeObjectFolder($path)
 {
     $folder = Folder::getByPath($path);
     if ($folder) {
         $folder->delete();
     }
 }
 public function removeFolders()
 {
     $blogFolder = Folder::getByPath('/coreshop');
     if ($blogFolder) {
         $blogFolder->delete();
     }
 }
Example #4
-1
 /**
  * @return OnlineShop_OfferTool_AbstractOffer
  * @throws Exception
  */
 protected function getNewOfferObject($tempOfferNumber)
 {
     if (!class_exists($this->offerClass)) {
         throw new Exception("Offer Class" . $this->offerClass . " does not exist.");
     }
     $offer = new $this->offerClass();
     /**
      * @var $offer OnlineShop_OfferTool_AbstractOffer
      */
     $offer->setParent(\Pimcore\Model\Object\Folder::getByPath($this->parentFolderPath));
     $offer->setCreationDate(Zend_Date::now()->get());
     $offer->setKey($tempOfferNumber);
     $offer->setPublished(true);
     $offer->setDateCreated(Zend_Date::now());
     return $offer;
 }