SecureRandomSchema.php 819B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. namespace JMS\SecurityExtraBundle\Security\Util;
  3. use Doctrine\DBAL\Schema\Schema;
  4. /**
  5. * The DBAL schema that will be used if you choose the database-based
  6. * seed provider.
  7. *
  8. * @author Johannes M. Schmitt <schmittjoh@gmail.com>
  9. */
  10. final class SecureRandomSchema extends Schema
  11. {
  12. public function __construct($tableName)
  13. {
  14. parent::__construct();
  15. $table = $this->createTable($tableName);
  16. $table->addColumn('seed', 'string', array(
  17. 'length' => 88,
  18. 'not_null' => true,
  19. ));
  20. $table->addColumn('updated_at', 'datetime', array(
  21. 'not_null' => true,
  22. ));
  23. }
  24. public function addToSchema(Schema $schema)
  25. {
  26. foreach ($this->getTables() as $table) {
  27. $schema->_addTable($table);
  28. }
  29. }
  30. }