I'm learning the Symfony framework and I'm having problems getting it to return the correct URL to a resource. I created a new bundle, Company/TestBundle, with this in my src/Company/TestBundle/Controller/DefaultController.php file:
<?php
namespace Company\TestBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class DefaultController extends Controller
{
public function indexAction()
{
return $this->render('TestBundle:Default:index.html.twig');
}
}
In src/Company/TestBundle/Resources/views/Default/index.html.twig:
{% extends "SmallworldBundle:Default:main.html.twig" %}
{%block title %}It's a small world after all!{% endblock %}
{% block body %} It's a small world! {% endblock %}
And in src/Company/TestBundle/Resources/views/Default/main.html.twig:
<html>
<head>
{% block stylesheets %}
<link rel = "stylesheet" href = "{{ asset('css/small.css') }}" type = "text/css" />
{% endblock %}
<title>{% block title %} {% endblock %}</title>
</head>
<body>
{%block body %}{% endblock %}
</body>
</html>
Now, I've run php app/console assets:install --symlink but even so, the generated code is trying to link to '/css/small.css' instead of where the file actually is, which is src/Company/TestBundle/Resources/public/css/small.css
Can someone explain why this isn't linking to the correct location?