mirror of
https://framagit.org/tykayn/date-poll-api
synced 2023-08-25 08:23:11 +02:00
⚡ start migration admin action
This commit is contained in:
parent
cce2319a10
commit
31dec906ea
@ -68,4 +68,33 @@ class AdminController extends FramadateController {
|
|||||||
200 );
|
200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Delete all expired polls and their children
|
||||||
|
* @Get(
|
||||||
|
* path = "/polls/migrate",
|
||||||
|
* name = "_migrate_framadate",
|
||||||
|
* )
|
||||||
|
* token is set up in the main env file
|
||||||
|
*/
|
||||||
|
public
|
||||||
|
function runMigrationFromOldFramadate(
|
||||||
|
string $token
|
||||||
|
) {
|
||||||
|
// TODO
|
||||||
|
// fetch old polls and store their properties in new poll objects
|
||||||
|
|
||||||
|
$foundPolls = [];
|
||||||
|
$database_name = 'symfony';
|
||||||
|
|
||||||
|
$em = $this->getDoctrine()->getManager();
|
||||||
|
$emPoll = $this->getDoctrine()->getRepository( Poll::class );
|
||||||
|
|
||||||
|
return $this->json( [
|
||||||
|
'message' => 'migration done for: ' . count( $foundPolls ). ' - this feature is not ready to work YET.',
|
||||||
|
'data' => [
|
||||||
|
'count' => count( $foundPolls ),
|
||||||
|
],
|
||||||
|
],
|
||||||
|
200 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user