I want to run php script in command line. I have created this file into root folder. and want to run only once.
binary.php
global $em;
$binaryContentRepository = $em->getRepository('\xxx\Entity\xxxx');
$datas = $binaryContentRepository->getAllAttechment();
foreach($datas as $data){
$ext = pathinfo($data['filename'], PATHINFO_EXTENSION);
file_put_contents("C:\\xxxxxx\\".$data['id'].".".$ext, $data['content']);
}
I have try to run this file php -f binary.php. But can not run successfully.
$em;set?