Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7051005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T03:12:44+00:00 2026-05-28T03:12:44+00:00

My site I have some content can be voted (+/-). It is working fine

  • 0

My site I have some content can be voted (+/-). It is working fine now, when all content has its own voter.
Now I’m looking for a way to create a single voting bundle with a entity(votedModel,votedId, user, vote).
Basically the bundle is ready. My problem is how to use it. I’d like to be able to do something like:

class ... extends Controller {
    function showAction(Request $request,$id) {
        ...
        $voter=new Voter('myCOntentType',$id,$userid);

        ...
        return $this->render('...', array('voter'=>$voter->getVoter(),...))
    }
}

getVoter() would create the voter view.

  • but I’m stacked how exactly start. I tried to call for the other controller in this manner, but can’t create the voter form.

  • It worked with $voter=$this->forward('VoterbundleNewAction', array('id=>$id,'user'=>$user)->getContent();
    But this wasn’t I had in mind.

I think my approach is all wrong and I may need to do this as service. I cant find my way around.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T03:12:44+00:00Added an answer on May 28, 2026 at 3:12 am

    You can use include or render in your twig template to get other templates’ output. So you could create a template (say, voter.html.twig) that contains the HTML for your voting system, and in the Twig, in any place where you need a voter, you could use:

    {% include "AcmeVoterBundle:Voter:voter.html.twig" %}
    

    or

    {% render "AcmeVoterBundle:Voter:voter" with {"item": item} %}
    

    In the first example, you simply include another template (see also: http://symfony.com/doc/current/book/templating.html#including-other-templates), in the latter situation you actually execute another action method of a controller and the output of that is put into your current template (see also: http://symfony.com/doc/current/book/templating.html#embedding-controllers)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to develop a site on Drupal 7. I have some content types
I have an asp.net mvc 1.0 site that serves some content from a 2
I have to convert an HTML site into joomla.Some Content of the site contain
I'm working on a site and I have some problems that I hope you
I have a site with some restricted content. I want my site to appear
The scenario is this: I have some users on my site. A user has
I have some site where I am embedding a couple of youtube videos in
We will develop a web site that will have some free services and we
I have some mega menu style menus on a site I maintain. These are
I have some code that sets the lang var to the site default language.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.