Skip to content

Instantly share code, notes, and snippets.

@docteurklein
Last active December 15, 2015 00:09
Show Gist options
  • Save docteurklein/5171196 to your computer and use it in GitHub Desktop.
Save docteurklein/5171196 to your computer and use it in GitHub Desktop.
php interactive CLI with symfony ready application $ ./app/cli
#!php -ad auto_prepend_file=cli
<?php
set_time_limit(0);
require_once __DIR__.'/autoload.php';
require_once __DIR__.'/AppKernel.php';
Symfony\Component\Debug\Debug::enable();
$kernel = new AppKernel('cli', true);
$kernel->boot();
$c = $kernel->getContainer();
$d = $c->get('doctrine');
$em = $d->getManager();
@docteurklein
Copy link
Author

<?php
$em->getRepository('App:BlogPost')->find(1)->publish();
$em->flush();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment