public function boot()
 {
     if (!Type::hasType('branch_logo')) {
         Type::addType('branch_logo', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\BranchLogoType');
     }
     if (!Type::hasType('priority')) {
         Type::addType('priority', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketPriorityType');
     }
     if (!Type::hasType('file')) {
         Type::addType('file', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\AttachmentFileType');
     }
     if (!Type::hasType('status')) {
         Type::addType('status', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketStatusType');
     }
     if (!Type::hasType('source')) {
         Type::addType('source', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketSourceType');
     }
     if (!Type::hasType('ticket_sequence_number')) {
         Type::addType('ticket_sequence_number', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketSequenceNumberType');
     }
     if (!Type::hasType('ticket_unique_id')) {
         Type::addType('ticket_unique_id', 'Diamante\\DeskBundle\\Infrastructure\\Persistence\\Doctrine\\DBAL\\Types\\TicketUniqueIdType');
     }
     foreach ($this->dataAuditTypes as $type) {
         if (!AuditFieldTypeRegistry::hasType($type)) {
             AuditFieldTypeRegistry::addType($type, $type);
         }
     }
     $em = $this->container->get('doctrine.orm.default_entity_manager');
     $conn = $em->getConnection();
     $conn->getDatabasePlatform()->registerDoctrineTypeMapping('FILE', 'string');
 }
 public function testAuditFieldTypeRegistry()
 {
     $this->assertFalse(AuditFieldTypeRegistry::hasType('newtype'));
     AuditFieldTypeRegistry::addType('newtype', 'newtype_');
     $this->assertTrue(AuditFieldTypeRegistry::hasType('newtype'));
     $this->assertEquals('newtype_', AuditFieldTypeRegistry::getAuditType('newtype'));
     AuditFieldTypeRegistry::overrideType('newtype', 'overridentype');
     $this->assertEquals('overridentype', AuditFieldTypeRegistry::getAuditType('newtype'));
     AuditFieldTypeRegistry::removeType('newtype');
     $this->assertFalse(AuditFieldTypeRegistry::hasType('newtype'));
 }
 /**
  * @param array $row
  * @param array $data
  */
 private function processArrayData(array $row, array $data)
 {
     foreach ($data as $field => $values) {
         $visible = true;
         $fieldType = $this->getFieldType($row['entity_id'], $field);
         $dataType = null;
         if (!AuditFieldTypeRegistry::hasType($fieldType) || !array_key_exists('old', $values) || !array_key_exists('new', $values)) {
             $dataType = 'array';
             $visible = false;
         } else {
             $dataType = AuditFieldTypeRegistry::getAuditType($fieldType);
         }
         $dbData = ['audit_id' => $row['id'], 'data_type' => $dataType, 'field' => $field, sprintf('old_%s', $dataType) => $this->parseValue($values, 'old'), sprintf('new_%s', $dataType) => $this->parseValue($values, 'new'), 'visible' => $visible];
         $types = ['integer', 'string', 'string', $dataType, $dataType, 'boolean'];
         $this->connection->insert('oro_audit_field', $dbData, $types);
     }
 }