| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Coverage | 77.78% |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class ObjectToTabellaExtension extends \Twig_Extension |
||
| 8 | { |
||
| 9 | private $tableprefix; |
||
| 10 | |||
| 11 | 25 | public function __construct($tableprefix) |
|
| 12 | { |
||
| 13 | 25 | $this->tableprefix = $tableprefix; |
|
| 14 | 25 | } |
|
| 15 | |||
| 16 | public function getFunctions() |
||
| 17 | { |
||
| 18 | return array( |
||
| 19 | new \Twig_SimpleFunction('object2view', array($this, 'object2View', 'is_safe' => array('html'))), |
||
| 20 | new \Twig_SimpleFunction('field2object', array($this, 'field2Object', 'is_safe' => array('html'))), |
||
| 21 | new \Twig_SimpleFunction('joinfieldid', array($this, 'joinFieldId', 'is_safe' => array('html'))), |
||
| 22 | ); |
||
| 23 | } |
||
| 24 | |||
| 25 | 7 | public function object2View($object, $type = null, $decodifiche = null) |
|
| 26 | { |
||
| 27 | 7 | $dfr = new DoctrineFieldReader($this->tableprefix); |
|
| 28 | 7 | return $dfr->object2View($object, $type, $decodifiche); |
|
| 29 | } |
||
| 30 | |||
| 31 | 7 | public function field2Object($fieldname, $object, $decodifiche = null) |
|
| 32 | { |
||
| 33 | 7 | $dfr = new DoctrineFieldReader($this->tableprefix); |
|
| 34 | 7 | return $dfr->getField2Object($fieldname, $object, $decodifiche); |
|
| 35 | } |
||
| 36 | 2 | public function joinFieldId($object) |
|
| 43 | } |
||
| 44 | } |
||
| 45 |