mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-12 12:33:26 +00:00
modify datas for bridge
This commit is contained in:
@@ -72,17 +72,17 @@ class Bridge_Api_Apitest_Containers implements Bridge_Api_ContainerInterface
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_category()
|
public function get_category()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_private()
|
public function is_private()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_rating()
|
public function get_rating()
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -170,8 +170,12 @@ class Bridge_Api_Apitest_Element implements Bridge_Api_ElementInterface
|
|||||||
|
|
||||||
class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Interface
|
class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Interface
|
||||||
{
|
{
|
||||||
|
|
||||||
const AUTH_TYPE = 'None';
|
const AUTH_TYPE = 'None';
|
||||||
|
|
||||||
|
public static $hasError = false;
|
||||||
|
public static $hasException = false;
|
||||||
|
|
||||||
public function __construct(registryInterface $registry, Bridge_Api_Auth_Interface $auth)
|
public function __construct(registryInterface $registry, Bridge_Api_Auth_Interface $auth)
|
||||||
{
|
{
|
||||||
parent::__construct($registry, $auth);
|
parent::__construct($registry, $auth);
|
||||||
@@ -380,19 +384,31 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create_container($container_type, Request $request)
|
public function create_container($container_type, \Symfony\Component\HttpFoundation\Request $request)
|
||||||
{
|
{
|
||||||
|
if (self::$hasException)
|
||||||
|
{
|
||||||
|
self::$hasException = false;
|
||||||
|
throw new \Exception("une erreur");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_element_to_container($element_type, $element_id, $destination, $container_id)
|
public function add_element_to_container($element_type, $element_id, $destination, $container_id)
|
||||||
{
|
{
|
||||||
|
if (self::$hasException)
|
||||||
|
{
|
||||||
|
self::$hasException = false;
|
||||||
|
throw new \Exception("une erreur");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function delete_object($object, $object_id)
|
public function delete_object($object, $object_id)
|
||||||
{
|
{
|
||||||
|
if (self::$hasException)
|
||||||
|
{
|
||||||
|
self::$hasException = false;
|
||||||
|
throw new \Exception("une erreur");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -401,7 +417,11 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
*/
|
*/
|
||||||
public function acceptable_records()
|
public function acceptable_records()
|
||||||
{
|
{
|
||||||
|
$func = function($record)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
return $func;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_element_status(Bridge_Element $element)
|
public function get_element_status(Bridge_Element $element)
|
||||||
@@ -436,12 +456,17 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
public function check_upload_constraints(array $datas, record_adapter $record)
|
public function check_upload_constraints(array $datas, record_adapter $record)
|
||||||
{
|
{
|
||||||
|
if (self::$hasError)
|
||||||
|
{
|
||||||
|
self::$hasError = false;
|
||||||
|
return array('title' => 'too long');
|
||||||
|
}
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_upload_datas(Request $request, record_adapter $record)
|
public function get_upload_datas(\Symfony\Component\HttpFoundation\Request $request, record_adapter $record)
|
||||||
{
|
{
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function is_multiple_upload()
|
public function is_multiple_upload()
|
||||||
@@ -451,12 +476,26 @@ class Bridge_Api_Apitest extends Bridge_Api_Abstract implements Bridge_Api_Inter
|
|||||||
|
|
||||||
public function check_update_constraints(Array $datas)
|
public function check_update_constraints(Array $datas)
|
||||||
{
|
{
|
||||||
|
if (!self::$hasError)
|
||||||
|
{
|
||||||
|
if (self::$hasException)
|
||||||
|
{
|
||||||
|
self::$hasException = false;
|
||||||
|
throw new \Exception('une erreur');
|
||||||
|
}
|
||||||
|
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
elseif (self::$hasError)
|
||||||
|
{
|
||||||
|
self::$hasError = false;
|
||||||
|
return array('title' => 'too long');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function get_update_datas(Request $request)
|
public function get_update_datas(\Symfony\Component\HttpFoundation\Request $request)
|
||||||
{
|
{
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user