// Symfony 2
public function updateAction($id)
{
$em = $this->getDoctrine()->getEntityManager();
$product = $em->getRepository('AcmeStoreBundle:Product')->find($id);
if (!$product) {
throw $this->createNotFoundException('No product found for id '.$id);
}
$product->setName('New product name!');
$em->flush();
return $this->redirect($this->generateUrl('homepage'));
}
# Django
def updateAction(request, id):
product = Product.objects.get(pk=id)
# Product.DoesNotExist exception raised if not found
product.name = u"New product name!"
product.save()
return HttpResponseRedirect(reverse('homepage'))
6 Comments on “The more Symfony2 learn, the more I like Django”
You can track this conversation through its atom feed.
The title could also be “The more PHP-Frameworks I learn, the more I like Django”
Posted on October 14, 2011 at 4:40 pm.
True, but I must admit that of all the frameworks I’ve tried, Symfony2 is the best. We are using it for the new version of Siwapp but is a big effort to learn how it works!
Posted on October 15, 2011 at 11:58 am.
Definitely I like Django more than Symfony. I think the problem is the complexity of Doctrine and its tight integration with Symfony. Once upon a time an ORM that was powerful and not so complicated called Doctrine…
Posted on December 29, 2011 at 11:15 am.
Of course, if I need a PHP framework I will use Symfony.
Posted on December 29, 2011 at 11:16 am.
Hi,
We were on the road to symfony2 siwapp. Is there any work in progress? WE would like to collaborate.
Thank you in advance…
Posted on February 7, 2012 at 8:44 pm.
Álvaro, puedes acudir directamente a y unirte a los grupos de Google de usuarios y desarrolladores (sobre todo este último) y si ves que puedes aportar código, ideas, etc… adelante.
Posted on February 9, 2012 at 11:35 am.