This repository has been archived on 2026-07-19. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
espocrm-base/application/Espo/Core/Doctrine/EspoConverter.php
T
2013-11-15 17:36:28 +02:00

47 lines
937 B
PHP

<?php
namespace Espo\Core\Doctrine;
class EspoConverter
{
private $metadata;
public function __construct(\Espo\Core\Utils\Metadata $metadata)
{
$this->metadata = $metadata;
}
public function getMetadata()
{
return $this->metadata;
}
/**
* Metadata conversion from Espo format into Doctrine
*
* @param string $name
* @param array $data
* @param bool $withName - different return array. If $withName=false, then return is "array()"; $withName=true, then array('name'=>$entityName, 'meta'=>$doctrineMeta);
*
* @return array
*/
//NEED TO CHANGE
function convert($name, $data, $withName=false)
{
//HERE SHOULD BE CONVERSION FUNCTIONALITY
$entityFullName= $this->getMetadata()->getEntityPath($name, '\\');
$doctrineMeta= array(
$entityFullName => $data
);
if ($withName) {
return array('name'=>$entityFullName, 'meta'=>$doctrineMeta);
}
return $doctrineMeta;
}
}
?>