Inheritance: extends Gc\Core\Object
コード例 #1
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete layout
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $id = $this->getId();
     if (!empty($id)) {
         try {
             parent::delete(array('id' => $id));
         } catch (\Exception $e) {
             throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
         }
         if (file_exists($this->getFilePath())) {
             unlink($this->getFilePath());
         }
         $this->events()->trigger(__CLASS__, 'after.delete', $this);
         unset($this);
         return true;
     }
     $this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
     return false;
 }
コード例 #2
0
ファイル: AbstractForm.php プロジェクト: gotcms/gotcms
 /**
  * Load values
  *
  * @param AbstractTable $table Table
  *
  * @return AbstractForm
  */
 public function loadValues(AbstractTable $table)
 {
     $data = $table->getData();
     $inputFilter = $this->getInputFilter();
     if (is_array($data)) {
         foreach ($data as $elementName => $elementValue) {
             if ($this->has($elementName)) {
                 $this->get($elementName)->setValue($elementValue);
             }
             if ($inputFilter->has($elementName)) {
                 $validators = $inputFilter->get($elementName)->getValidatorChain()->getValidators();
                 foreach ($validators as $validator) {
                     if ($validator['instance'] instanceof NoRecordExists) {
                         $validator['instance']->setExclude(array('field' => 'id', 'value' => $table->getId()));
                     }
                 }
             }
         }
     }
     return $this;
 }
コード例 #3
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete event
  *
  * @return boolean
  */
 public function delete()
 {
     $id = $this->getId();
     if (!empty($id)) {
         try {
             parent::delete(array('id' => $id));
         } catch (\Exception $e) {
             throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
         }
         unset($this);
         return true;
     }
     return false;
 }
コード例 #4
0
ファイル: AbstractTableTest.php プロジェクト: gotcms/gotcms
 /**
  * Test
  *
  * @return void
  */
 public function testGetDriverName()
 {
     $this->assertInternalType('string', $this->object->getDriverName());
 }
コード例 #5
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete tab
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $tabId = $this->getId();
     if (!empty($tabId)) {
         try {
             $propertiesCollection = new Property\Collection();
             $propertiesCollection->load(null, $tabId);
             $propertiesCollection->delete();
             parent::delete(array('id' => $tabId));
         } catch (\Exception $e) {
             throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
         }
         $this->events()->trigger(__CLASS__, 'after.delete', $this);
         unset($this);
         return true;
     }
     $this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
     return false;
 }
コード例 #6
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete document
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $documentId = $this->getId();
     if (!empty($documentId)) {
         try {
             $propertiesTable = new TableGateway('property_value', $this->getAdapter());
             $propertiesTable->delete(array('document_id' => $this->getId()));
             parent::delete(array('id' => $documentId));
         } catch (\Exception $e) {
             throw new \Gc\Exception($e->getMessage(), $e->getCode(), $e);
         }
         $this->events()->trigger(__CLASS__, 'after.delete', $this);
         unset($this);
         return true;
     }
     $this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
     return false;
 }
コード例 #7
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete Role
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $id = $this->getId();
     if (!empty($id)) {
         parent::delete(array('id' => $id));
         $this->events()->trigger(__CLASS__, 'after.delete', $this);
         unset($this);
         return true;
     }
     $this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
     return false;
 }
コード例 #8
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete property
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $id = $this->getId();
     if (!empty($id)) {
         try {
             parent::delete(array('id' => (int) $id));
             $table = new TableGateway('property_value', $this->getAdapter());
             $table->delete(array('property_id' => (int) $id));
         } catch (\Exception $e) {
             throw new \Gc\Exception($e->getMessage());
         }
         $this->events()->trigger(__CLASS__, 'after.delete', $this);
         return true;
     }
     $this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
     return false;
 }
コード例 #9
0
ファイル: Model.php プロジェクト: gotcms/gotcms
 /**
  * Delete document type model
  *
  * @return boolean
  */
 public function delete()
 {
     $this->events()->trigger(__CLASS__, 'before.delete', $this);
     $documentTypeId = $this->getId();
     if (!empty($documentTypeId)) {
         $tabCollection = new Tab\Collection();
         $tabCollection->load($documentTypeId);
         $tabCollection->delete();
         $table = new TableGateway('document_type_view', $this->getAdapter());
         $table->delete(array('document_type_id' => (int) $documentTypeId));
         parent::delete(array('id' => $documentTypeId));
         $this->events()->trigger(__CLASS__, 'after.delete', $this);
         unset($this);
         return true;
     }
     $this->events()->trigger(__CLASS__, 'after.delete.failed', $this);
     return false;
 }