Ejemplo n.º 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->serviceLocator->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;
 }
Ejemplo n.º 2
0
 /**
  * Ensure that getSecurity isn't implemented in the default Service Locator
  *
  * @expectedException Exception
  */
 public function testGetSecurity()
 {
     Atrox_Core_ServiceLocator::getSecurity();
 }
Ejemplo n.º 3
0
 /**
  * Injects a particualr instance of Atrox_Core_ServiceLocator sub class.
  *
  * @param Atrox_Core_ServiceLocator $instance
  *
  * @return null
  */
 public static function load(Atrox_Core_ServiceLocator $instance)
 {
     self::$instance = $instance;
 }
Ejemplo n.º 4
0
<?php

set_include_path(".:" . realpath(dirname(__FILE__) . "/..") . "/:" . PEAR_INSTALL_DIR);
require_once "Atrox/Core/Application/Application.php";
Atrox_Core_ServiceLocator::load(Atrox_Core_ServiceLocator::getInstance());
$application = Atrox_Core_ServiceLocator::getApplication();
//$application->setupCustomExceptionHandler();
$application->setName("Atrox Unit Test Application");
Ejemplo n.º 5
0
Archivo: View.php Proyecto: serby/Atrox
 /**
  *
  * @param int $code
  * @param array $errors
  *
  * @return void
  */
 public function displayError($code, $error)
 {
     $this->setStatus($code);
     $this->output($error);
     Atrox_Core_ServiceLocator::getLogger()->log($error, "Request", Atrox_Core_Logging_Logger::DEBUG);
 }
Ejemplo n.º 6
0
 public function query($query)
 {
     Atrox_Core_ServiceLocator::getInstance()->getLogger()->log($query, "Connection", Atrox_Core_Logging_Logger::DEBUG);
     $result = parent::query($query);
     return $result;
 }
Ejemplo n.º 7
0
 public function __construct()
 {
     $serviceLocator = Atrox_Core_ServiceLocator::getInstance();
     $dataAdaptorfactory = $serviceLocator->getDataAdaptorFactory();
     $this->contacts = new $dataAdaptorfactory->getCollection("Contact", Atrox_Base_AddressBook_Contact::getSchema(), $serviceLocator->getConnection());
 }
Ejemplo n.º 8
0
 /**
  *
  * @param Exception $exception
  */
 protected function exceptionHandler(Exception $exception)
 {
     $logger = Atrox_Core_ServiceLocator::getInstance()->getLogger();
     $logger->log($exception, "Exception", Atrox_Core_Logging_Logger::ERROR);
     if (method_exists($exception, "getContext")) {
         $logger->log($exception->getContext(), "Exception", Atrox_Core_Logging_Logger::ERROR);
     }
     if (ini_get("display_errors")) {
         @header("Content-type: text/plain");
         echo $exception;
     } else {
         @header("HTTP/1.1 500 Internal Server Error");
         @header("Status: 500 Internal Server Error");
         exit;
     }
     return false;
 }