-
-
Save ignat-s/bd33854cd762d63307da to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 | |
]); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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