Commit db1c7ec0 authored by Hermann Mayer's avatar Hermann Mayer

Updated solr config. Removed code dupplicates. Improved Search Controller to…

Updated solr config. Removed code dupplicates. Improved Search Controller to deliver 'nothing' if solr config is not correct.
parent fe1cb4b0
nelmio_solarium:
clients:
default:
host: localhost
port: 8983
host: server.lan
port: 3180
path: /solr
core: jity
timeout: 5
......
deploy @ ed71157a
Subproject commit 40f859f7a7738326d2699fa851521556c4ebf82e
Subproject commit ed71157ad027d3b3faeb2c5b199ffdac24da54cd
......@@ -63,16 +63,16 @@ class SectionController extends Controller
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('JityHomepageBundle:Section')->find($id);
$section = $em->getRepository('JityHomepageBundle:Section')->find($id);
if (!$entity) {
if (!$section) {
throw $this->createNotFoundException('Unable to find Section entity.');
}
$serializer = $this->container->get('serializer');
return new Response(
$serializer->serialize($entity, 'json')
$serializer->serialize($section, 'json')
);
}
}
......
......@@ -63,16 +63,16 @@ class TagController extends Controller
{
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('JityHomepageBundle:Tag')->find($id);
$tag = $em->getRepository('JityHomepageBundle:Tag')->find($id);
if (!$entity) {
throw $this->createNotFoundException('Unable to find Section entity.');
if (!$tag) {
throw $this->createNotFoundException('Unable to find Tag entity.');
}
$serializer = $this->container->get('serializer');
return new Response(
$serializer->serialize($entity, 'json')
$serializer->serialize($tag, 'json')
);
}
}
......
......@@ -96,7 +96,7 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
$admin
->setEmail($config->admin['email'])
->setFirstName('Admin')
->setLastName('Mustermann')
->setLastName('Admin')
->setStatus(User::STATUS_ACTIVE)
->addGroup($this->getReference('admin-group'));
......@@ -110,7 +110,7 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
$author
->setEmail('author@jity.de')
->setFirstName('Author')
->setLastName('Mustermann')
->setLastName('Author')
->setStatus(User::STATUS_ACTIVE)
->addGroup($this->getReference('author-group'));
......@@ -124,7 +124,7 @@ class Load02UserData extends AbstractFixture implements OrderedFixtureInterface,
$user
->setEmail('user@jity.de')
->setFirstName('User')
->setLastName('Mustermann')
->setLastName('User')
->setStatus(User::STATUS_ACTIVE)
->addGroup($this->getReference('user-group'));
......
......@@ -118,7 +118,7 @@ Freunden und Bekannten über Googles Soziales Netzwerk oder über Facebook.
->setTitle('Folgen')
->setContent('<p>
{% if "Article" == page.getType %}
{% if "Article" == page.getType or "blog" == page.slug %}
Sie können den Aktivitäten dieses Artikels, mittels RSS Feed, folgen.
Oder folgen Sie meinen Aktivitäten auf Google+ oder über Twitter.
......@@ -133,7 +133,7 @@ Freunden und Bekannten über Googles Soziales Netzwerk oder über Facebook.
</p>
<p>
{% if "Article" == page.getType %}
{% if "Article" == page.getType or "blog" == page.slug %}
<a href="{{ app.request.uri }}.rss" class="btn btn-danger" title="RSS Feed abonnieren">
<img src="{{ asset("bundles/jityhomepage/img/glyphicons_397_rss.png") }}" />
......
......@@ -154,8 +154,15 @@ class SearchController extends AbstractService
$configure($client, $select);
}
// Fire the solr query
$rawResults = $client->select($select);
try {
// Fire the solr query
$rawResults = $client->select($select);
} catch (\Exception $e) {
return array();
}
$results = array();
......
......@@ -32,16 +32,18 @@ class Category
*/
protected $id;
/**
* @ORM\Column(type="string", length=100, unique=true)
*/
protected $name;
/**
* @ORM\OneToMany(targetEntity="AbstractPage", mappedBy="category")
**/
protected $pages;
/**
* Todo: Should be refactored to be a "Topic" metadata
* extention to better classify abstract pages.
* @ORM\Column(type="string", unique=true, length=50)
*/
protected $name;
/**
* __construct
......
......@@ -38,7 +38,10 @@ class Navigation
protected $name;
/**
* @ORM\OneToMany(targetEntity="AbstractPage", mappedBy="navigation")
* @ORM\OneToMany(
* targetEntity="AbstractPage",
* mappedBy="navigation"
* )
**/
protected $pages;
......
......@@ -38,56 +38,12 @@ class ArticleType extends AbstractType
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
// Reuse the complete PageType
$pageType = new PageType();
$pageType->buildForm($builder, $options);
$builder
->add('title', null, array(
'label' => 'Titel der Seite'
))
->add('slug', null, array(
'label' => 'Schlagzeile (für die Url)',
'attr' => array(
'rel' => 'popover',
'data-trigger' => 'focus',
'data-original-title' => 'Information',
'data-content' => 'Der Slug wird automatisch aus dem Titel generiert. Sie können ihn aber auch manuell festgelegt.'
)
))
->add('icon', null, array(
'attr' => array(
'data-target' => '#icons_modal',
'data-toggle' => 'modal'
),
'label' => 'Icon für die Navigation'
))
->add('content', null, array(
'attr' => array(
'rows' => '6',
'class' => 'span4',
'data-target' => '#editor_modal',
'data-toggle' => 'modal'
),
'label' => 'Inhalt'
))
->add('service', 'entity', array(
'class' => 'Jity\HomepageBundle\Entity\Service',
'property' => 'title',
'required' => false,
'label' => 'Service'
))
->add('category', 'entity', array(
'class' => 'Jity\HomepageBundle\Entity\Category',
'property' => 'name',
'label' => 'Kategorie'
))
->add('sidebar', 'entity', array(
'class' => 'Jity\HomepageBundle\Entity\Sidebar',
'property' => 'name',
'label' => 'Sidebar'
))
->add('navigation', 'entity', array(
'class' => 'Jity\HomepageBundle\Entity\Navigation',
'property' => 'name',
'label' => 'Navigation'
))
->add('tags', 'collection', array(
'type' => new TagType(),
'allow_add' => true,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment