0

I am developing a backup system. I want to backup my database will all it rows.

I have found something, but it is not what exactly i need

$em = $this->getContainer()->get('doctrine')->getManager();
$schemaTool = new SchemaTool($em);
$metadatas = $em->getMetadataFactory()->getAllMetadata();

$sqls = $schemaTool->getCreateSchemaSql($metadatas);

It just creates the schema, but not the content. I'm using Postgresql.

How should i get my database dump with contents in php/symfony ?

thank you!

Tigran
  • 633
  • 4
  • 17
  • 26
  • 8
    possible [duplicate](http://stackoverflow.com/questions/9071669/dump-database-data-using-doctrine-2). TBH, if youre looking to backup your database on a server, you should be using a cron job + script. Not relying on the framework. – DevDonkey Mar 01 '16 at 13:12
  • 1
    Do you absolutely need to do it through Symfony? Can't you use shell scripts and crons? – Terenoth Mar 01 '16 at 13:12
  • use `mysqldump` from mysql symfony is not needed. – Robert Mar 01 '16 at 13:15
  • Not important it will be script or symfony. Im looking for any solution. Robert, cant you see, i wrote i'm using Postgresql. – Tigran Mar 01 '16 at 13:21
  • 3
    so use `pg_dump dbname > outfile` which is still better than using framework – Robert Mar 01 '16 at 13:25
  • Okay, i will try it, Thank you – Tigran Mar 01 '16 at 13:27

0 Answers0