mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-10 10:24:31 +02:00
Reset autoincrement in a custom purger not in DataFixtures.
This makes things a lot prettier in the DataFixtures.
This commit is contained in:
parent
bd4c20765a
commit
63065a8b58
8 changed files with 326 additions and 10 deletions
|
@ -93,9 +93,6 @@ class DataStructureFixtures extends Fixture
|
|||
throw new InvalidArgumentException('$class must be a StructuralDBElement!');
|
||||
}
|
||||
|
||||
$table_name = $this->em->getClassMetadata($class)->getTableName();
|
||||
$this->em->getConnection()->exec("ALTER TABLE `${table_name}` AUTO_INCREMENT = 1;");
|
||||
|
||||
/** @var AbstractStructuralDBElement $node1 */
|
||||
$node1 = new $class();
|
||||
$node1->setName('Node 1');
|
||||
|
|
|
@ -40,7 +40,6 @@ class LabelProfileFixtures extends Fixture
|
|||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$this->em->getConnection()->exec('ALTER TABLE `label_profiles` AUTO_INCREMENT = 1;');
|
||||
|
||||
$profile1 = new LabelProfile();
|
||||
$profile1->setName('Profile 1');
|
||||
|
|
|
@ -50,8 +50,6 @@ class PartFixtures extends Fixture
|
|||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
$table_name = $this->em->getClassMetadata(Part::class)->getTableName();
|
||||
$this->em->getConnection()->exec("ALTER TABLE `${table_name}` AUTO_INCREMENT = 1;");
|
||||
|
||||
/** Simple part */
|
||||
$part = new Part();
|
||||
|
|
|
@ -61,9 +61,6 @@ class UserFixtures extends Fixture
|
|||
|
||||
public function load(ObjectManager $manager): void
|
||||
{
|
||||
//Reset autoincrement
|
||||
$this->em->getConnection()->exec('ALTER TABLE `users` AUTO_INCREMENT = 1;');
|
||||
|
||||
$anonymous = new User();
|
||||
$anonymous->setName('anonymous');
|
||||
$anonymous->setGroup($this->getReference(GroupFixtures::READONLY));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue