Inheritance: extends AbstractCrud
Exemplo n.º 1
0
 /**
  * updateOne
  *
  * @param array $data
  * @return integer
  */
 public function updateOne($id, $data)
 {
     $id = (int) $id[0];
     \Application\MusicianType\Table::getInstance()->updateTypes($data['types'], $id);
     if (Session::get('image') != '') {
         $data['image'] = Session::get('image');
     }
     $result = parent::updateOne($id, $data);
     return $result;
 }
Exemplo n.º 2
0
 /**
  * @param mixed $data
  * @return int|void
  */
 public function deleteOne($data)
 {
     $table = Table::getInstance();
     $tree = $table->buildTree($data['id']);
     if (!isset($tree[0]['children'])) {
         parent::deleteOne($data);
     } else {
         $allSubCategories = $this->treeToArray($tree);
         foreach ($allSubCategories as $categoryId) {
             parent::deleteOne(['id' => $categoryId]);
         }
     }
 }
Exemplo n.º 3
0
 public function readOne($primary)
 {
     $filesArray = unserialize(Session::get('files'));
     $path = Config::getModuleData('menu', 'full_path');
     if ($filesArray) {
         foreach ($filesArray as $file) {
             $filename = $path . $file->getFullName();
             if (is_file($filename)) {
                 unlink($filename);
             }
         }
     }
     Session::delete('files');
     return parent::readOne($primary);
 }