Android Tutorial: How to Build a Login Screen

My first Android tutorial is live here:

You will find a full code example on how to build an Android login screen using an API web service to check the username and password before allowing users to access some part of your applications. Please enjoy and let us know in the comments if you have any suggestions to improve this.

Fix SoftDeletable Doctrine Entities with Unique Index Columns (Symfony2)

If you are using the Gedmo SoftDeletable Doctrine extension for entities that have some unique index columns, you will probably encounter a MySQL error when trying to add new entity with the same values as one previously deleted:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ... for key …

Find out how to avoid this by reading this post: Symfony2: Gedmo SoftDeletable Doctrine Entities with Unique Index Columns.

How to get the current route and URL in Symfony2

To get the current URL in a Symfony2 project, use the following code.

In a controller:

public function someAction(\Symfony\Component\HttpFoundation\Request $request)
    $route = $request->get('_route');
    $url = $request->getUri();

In a TWIG template:

{{ app.request.get('_route') }}

{{ app.request.getUri }}

Why would you need this? For example to setup social share buttons for the current page.