Beispiel #1
0
 public function delete(EntityInterface $entity)
 {
     if ($entity['disabled']) {
         return 0;
     }
     return parent::delete($entity);
 }
Beispiel #2
0
 /**
  * (non-PHPdoc)
  * @see \Micro\Model\DatabaseAbstract::save()
  */
 public function save(EntityInterface $entity)
 {
     try {
         $this->beginTransaction();
         $test = strip_tags($entity->getDescription());
         if (empty($test)) {
             $entity->setDescription(null);
         }
         if ($entity->getDateStart()) {
             $date = new \DateTime($entity->getDateStart());
             $entity->setDateStart($date->format('Y-m-d'));
         }
         if ($entity->getDateEnd()) {
             $date = new \DateTime($entity->getDateEnd());
             $entity->setDateEnd($date->format('Y-m-d'));
         }
         $result = parent::save($entity);
         $this->commit();
     } catch (\Exception $e) {
         $this->rollback();
         throw $e;
     }
     return $result;
 }
Beispiel #3
0
 public function applyPaginatorFilters(array $params)
 {
     $classes = null;
     if (isset($params['classes']) && $params['classes']) {
         $classes = $params['classes'];
         unset($params['classes']);
     }
     parent::applyPaginatorFilters($params);
     if ($classes !== null) {
         $this->addWhere(new \Micro\Database\Expr('FIND_IN_SET(' . $classes . ', classes)'));
     }
 }