/** * @param FormMapper $formMapper */ protected function configureFormFields(FormMapper $formMapper) { $conf = $this->getConfigurationPool()->getContainer()->getParameter('webtown_php_banner'); $places = []; if (isset($conf['place'])) { foreach ($conf['place'] as $key => $data) { $places[$data['label']] = $key; } } $formMapper->add('name')->add('target')->add('place', 'choice', array('choices' => $places, 'choice_translation_domain' => 'WebtownPhpBannerBundle'))->add('priority')->add('maxDisplayCount')->add('startAt')->add('endAt')->add('isActive')->add('contentType', 'choice', array('choices' => Banner::getContentTypeChoices(), 'choice_translation_domain' => 'WebtownPhpBannerBundle'))->add('content'); }
/** * Increase click counter for banner * * @param Banner $banner */ public function incrementClickCountForBanner(Banner $banner) { $this->_em->createQuery('UPDATE WebtownPhpBannerBundle:Banner b WHERE b.id = :id SET b.clickCount = b.clickCount+1')->setParameter('id', $banner->getId())->execute(); }