mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-27 17:28:39 +00:00
some parameters, new entry form, etc.
This commit is contained in:
parent
163eae0bb1
commit
b84a80559a
9 changed files with 123 additions and 50 deletions
|
@ -7,9 +7,51 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
|
|||
use Symfony\Component\HttpFoundation\Request;
|
||||
use WallabagBundle\Repository;
|
||||
use WallabagBundle\Entity\Entries;
|
||||
use Wallabag\Wallabag\Tools;
|
||||
use Wallabag\Wallabag\Url;
|
||||
|
||||
class EntryController extends Controller
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @Route("/new", name="new_entry")
|
||||
* @return \Symfony\Component\HttpFoundation\Response
|
||||
*/
|
||||
public function addEntryAction(Request $request)
|
||||
{
|
||||
$entry = new Entries();
|
||||
$entry->setUserId(1);
|
||||
|
||||
$form = $this->createFormBuilder($entry)
|
||||
->add('url', 'url')
|
||||
->add('save', 'submit')
|
||||
->getForm();
|
||||
|
||||
$form->handleRequest($request);
|
||||
|
||||
if ($form->isValid()) {
|
||||
|
||||
$content = Tools::getPageContent(new Url($entry->getUrl()));
|
||||
var_dump($content);die;
|
||||
|
||||
$em = $this->getDoctrine()->getEntityManager();
|
||||
$em->persist($entry);
|
||||
$em->flush();
|
||||
|
||||
$this->get('session')->getFlashBag()->add(
|
||||
'notice',
|
||||
'Entry saved'
|
||||
);
|
||||
|
||||
return $this->redirect($this->generateUrl('homepage'));
|
||||
}
|
||||
|
||||
return $this->render('WallabagBundle:Entry:new.html.twig', array(
|
||||
'form' => $form->createView(),
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Shows unread entries for current user
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue