Example #1
0
 /**
  * (non-PHPdoc)
  * @see Atrox/Core/Data/Atrox_Core_Data_Source#delete()
  */
 public function delete(Atrox_Core_Data_Entity $entity)
 {
     if (!is_numeric($id = $entity->getId())) {
         throw new Exception("Non-integer ID passed to delete: " . $entity->getId());
         return false;
     }
     if (!$entity->beforeDelete()) {
         throw new Exception("beforeDelete failed");
         return false;
     }
     $result = $this->quickDelete($id);
     if ($this->connection->getAffectedCount($result) != 1) {
         return false;
     }
     $this->application->getCacheManager()->clear($this->getCacheKey($this->idName . ":" . $id));
     foreach ($this->properties as $name => $property) {
         if ($property->getType() == Atrox_Core_Data_Property::TYPE_BINARY) {
             $this->deleteBinary($entity->get($name));
         }
     }
     if (!$entity->afterDelete()) {
         throw new Exception("afterDelete failed");
         return false;
     }
     return true;
 }
Example #2
0
 public function query($query)
 {
     $application = Atrox_Application_Application::getInstance();
     $result = parent::query($sql);
     $application->log($sql, "sql");
     $application->log("Error: " . mysql_error($this->connection), "sql");
     return $result;
 }
Example #3
0
 /**
  * @return Atrox_Application_Application
  */
 public static function getApplication()
 {
     static $serviceInstance;
     return isset($serviceInstance) ? $serviceInstance : Atrox_Application_Application::getInstance();
 }