mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-11 20:13:28 +00:00
Implements BusinessFields in serializer
This commit is contained in:
@@ -56,15 +56,15 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function serialize($format)
|
public function serialize($format, $includeBusinessFields = false)
|
||||||
{
|
{
|
||||||
switch ($format)
|
switch ($format)
|
||||||
{
|
{
|
||||||
case self::SERIALIZE_XML:
|
case self::SERIALIZE_XML:
|
||||||
return $this->serializeXML();
|
return $this->serializeXML(!!$includeBusinessFields);
|
||||||
break;
|
break;
|
||||||
case self::SERIALIZE_YAML:
|
case self::SERIALIZE_YAML:
|
||||||
return $this->serializeYAML();
|
return $this->serializeYAML(!!$includeBusinessFields);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new \Exception(sprintf('Unknown format %s', $format));
|
throw new \Exception(sprintf('Unknown format %s', $format));
|
||||||
@@ -72,11 +72,11 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function serializeYAML()
|
protected function serializeYAML($includeBusinessFields)
|
||||||
{
|
{
|
||||||
$buffer = array();
|
$buffer = array();
|
||||||
|
|
||||||
foreach ($this->get_fields() as $field)
|
foreach ($this->get_fields(array(), $includeBusinessFields) as $field)
|
||||||
{
|
{
|
||||||
$vi = $field->get_values();
|
$vi = $field->get_values();
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
return $dumper->dump($buffer, 3);
|
return $dumper->dump($buffer, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function serializeXML()
|
protected function serializeXML($includeBusinessFields)
|
||||||
{
|
{
|
||||||
$dom_doc = new DOMDocument('1.0', 'UTF-8');
|
$dom_doc = new DOMDocument('1.0', 'UTF-8');
|
||||||
$dom_doc->formatOutput = true;
|
$dom_doc->formatOutput = true;
|
||||||
@@ -116,7 +116,7 @@ class caption_record implements caption_interface, cache_cacheableInterface
|
|||||||
$description = $dom_doc->createElement('description');
|
$description = $dom_doc->createElement('description');
|
||||||
$record->appendChild($description);
|
$record->appendChild($description);
|
||||||
|
|
||||||
foreach ($this->get_fields() as $field)
|
foreach ($this->get_fields(array(), $includeBusinessFields) as $field)
|
||||||
{
|
{
|
||||||
$values = $field->get_values();
|
$values = $field->get_values();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user