Skip to content

Instantly share code, notes, and snippets.

@ignat-s
Last active December 11, 2015 01:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ignat-s/bd33854cd762d63307da to your computer and use it in GitHub Desktop.
Save ignat-s/bd33854cd762d63307da to your computer and use it in GitHub Desktop.
<?php
namespace Oro\Bundle\DataAuditBundle\Migration\Extension;
use Doctrine\DBAL\Schema\Schema;
use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;
class AuditFieldExtension
{
/**
* @param Schema $schema
* @param string $doctrineType
* @param string $auditType
*/
public function addType(Schema $schema, $doctrineType, $auditType, $extendOwner = ExtendScope::OWNER_SYSTEM)
{
$auditFieldTable = $schema->getTable('oro_audit_field');
$auditFieldTable->addColumn(sprintf('old_%s', $auditType), $doctrineType, [
'oro_options' => [
'extend' => ['owner' => $extendOwner]
],
'notnull' => false
]);
$auditFieldTable->addColumn(sprintf('new_%s', $auditType), $doctrineType, [
'oro_options' => [
'extend' => ['owner' => $extendOwner]
],
'notnull' => false
]);
}
}
<?php
// ...
use Oro\Bundle\EntityExtendBundle\EntityConfig\ExtendScope;
$this->auditFieldExtension->addType($schema, $doctrineType, $auditType, $extendOwner, ExtendScope::OWNER_CUSTOM);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment