how to make a simple star notation in symfony 3










0















Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.



Entity



 class Medecin

/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;

/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;




and here is my twig file where I display the doctor's data with the stars as well:



Twig



 <span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>


CSS






.rating i 
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;

.rating i.voted
color: #FFC107;

.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;

.rating small a
color: #999;
text-decoration: underline;





My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks










share|improve this question






















  • 1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her

    – Nikos M.
    Nov 15 '18 at 19:25











  • please consider accepting & up-voting my answer if helped you

    – Trix
    Nov 30 '18 at 19:42















0















Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.



Entity



 class Medecin

/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;

/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;




and here is my twig file where I display the doctor's data with the stars as well:



Twig



 <span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>


CSS






.rating i 
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;

.rating i.voted
color: #FFC107;

.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;

.rating small a
color: #999;
text-decoration: underline;





My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks










share|improve this question






















  • 1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her

    – Nikos M.
    Nov 15 '18 at 19:25











  • please consider accepting & up-voting my answer if helped you

    – Trix
    Nov 30 '18 at 19:42













0












0








0








Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.



Entity



 class Medecin

/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;

/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;




and here is my twig file where I display the doctor's data with the stars as well:



Twig



 <span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>


CSS






.rating i 
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;

.rating i.voted
color: #FFC107;

.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;

.rating small a
color: #999;
text-decoration: underline;





My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks










share|improve this question














Good evening, I try to allow patients to note the doctors they consulted, so that after the search for doctors, the most noticeable appear first. But here I do not know how to do it too much. And in the first place I added a voting attribute to my entity.



Entity



 class Medecin

/**
* @var int
*
* @ORMColumn(name="id", type="integer")
* @ORMId
* @ORMGeneratedValue(strategy="AUTO")
*/
private $id;

/**
* @var string
*
* @ORMColumn(name="sexe", type="string", length=40)
*/
public $sexe;

/**
* @var int
*
* @ORMColumn(name="note", type="integer")
*/
private $note = 0;




and here is my twig file where I display the doctor's data with the stars as well:



Twig



 <span class="rating">
% for i in 1..5 %
<i class="icon_star medecin.note >= (i * 20) ? 'voted' : ''"></i>
% endfor %
| <small> <strong> medecin.note </strong></small>
</span>


CSS






.rating i 
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;

.rating i.voted
color: #FFC107;

.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;

.rating small a
color: #999;
text-decoration: underline;





My problem is that when I fly over the stars no action happens. And then how to record the vote, when the patient clicks on the number of votes, and that his vote is recorded to the affiliated doctor ?
Thanks






.rating i 
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;

.rating i.voted
color: #FFC107;

.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;

.rating small a
color: #999;
text-decoration: underline;





.rating i 
color: #ddd;
font-size: 13px;
font-size: 0.8125rem;

.rating i.voted
color: #FFC107;

.rating small
margin-bottom: 0;
display: inline-block;
font-size: 12px;
font-size: 0.75rem;

.rating small a
color: #999;
text-decoration: underline;






javascript symfony rating-system






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 15 '18 at 19:06









Mohamed SackoMohamed Sacko

599




599












  • 1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her

    – Nikos M.
    Nov 15 '18 at 19:25











  • please consider accepting & up-voting my answer if helped you

    – Trix
    Nov 30 '18 at 19:42

















  • 1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her

    – Nikos M.
    Nov 15 '18 at 19:25











  • please consider accepting & up-voting my answer if helped you

    – Trix
    Nov 30 '18 at 19:42
















1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her

– Nikos M.
Nov 15 '18 at 19:25





1) a doctor can receive many ratings from many users, so you need to somehow save all those ratings in a seprate db table linked to doctro_id. 2) Then display average rating for each doctor 3) ratings should have aditional input fields in case a user (that has not yet rated the current doctor) whishes to rate her

– Nikos M.
Nov 15 '18 at 19:25













please consider accepting & up-voting my answer if helped you

– Trix
Nov 30 '18 at 19:42





please consider accepting & up-voting my answer if helped you

– Trix
Nov 30 '18 at 19:42












1 Answer
1






active

oldest

votes


















0














Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.



You need to have a Rating entity:



Doctor



class Doctor

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;

// ...



Rating



class Rating

// ...

/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;

/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;

/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;

// ...



Patient



class Patient

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;

// ...






share|improve this answer























  • Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

    – Mohamed Sacko
    Nov 16 '18 at 12:49











  • please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

    – Trix
    Nov 16 '18 at 12:59











  • Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

    – Mohamed Sacko
    Nov 16 '18 at 15:11











  • you should put your RatingType form in doctor profile and process it in your DoctorController

    – Trix
    Nov 16 '18 at 15:15










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326346%2fhow-to-make-a-simple-star-notation-in-symfony-3%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.



You need to have a Rating entity:



Doctor



class Doctor

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;

// ...



Rating



class Rating

// ...

/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;

/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;

/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;

// ...



Patient



class Patient

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;

// ...






share|improve this answer























  • Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

    – Mohamed Sacko
    Nov 16 '18 at 12:49











  • please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

    – Trix
    Nov 16 '18 at 12:59











  • Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

    – Mohamed Sacko
    Nov 16 '18 at 15:11











  • you should put your RatingType form in doctor profile and process it in your DoctorController

    – Trix
    Nov 16 '18 at 15:15















0














Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.



You need to have a Rating entity:



Doctor



class Doctor

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;

// ...



Rating



class Rating

// ...

/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;

/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;

/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;

// ...



Patient



class Patient

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;

// ...






share|improve this answer























  • Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

    – Mohamed Sacko
    Nov 16 '18 at 12:49











  • please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

    – Trix
    Nov 16 '18 at 12:59











  • Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

    – Mohamed Sacko
    Nov 16 '18 at 15:11











  • you should put your RatingType form in doctor profile and process it in your DoctorController

    – Trix
    Nov 16 '18 at 15:15













0












0








0







Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.



You need to have a Rating entity:



Doctor



class Doctor

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;

// ...



Rating



class Rating

// ...

/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;

/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;

/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;

// ...



Patient



class Patient

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;

// ...






share|improve this answer













Please code in English, not french nor Dutch, or Chinese. Choose English for your code base.



You need to have a Rating entity:



Doctor



class Doctor

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“doctor”)
*/
protected $ratings;

// ...



Rating



class Rating

// ...

/**
* @ORMColumn(type=“integer”, name=“value”)
*/
protected $value;

/**
* @ORMManyToOne(targetEntity=“Doctor”, inversedBy=“ratings”)
*/
protected $doctor;

/**
* @ORMManyToOne(targetEntity=“Patient”, inversedBy=“ratings”)
*/
protected $patient;

// ...



Patient



class Patient

// ...

/**
* @ORMOneToMany(targetEntity=“Rating”, mappedBy=“patient”, cascade=“persist”, “remove”)
*/
protected $ratings;

// ...







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 21:22









TrixTrix

10.2k85175




10.2k85175












  • Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

    – Mohamed Sacko
    Nov 16 '18 at 12:49











  • please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

    – Trix
    Nov 16 '18 at 12:59











  • Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

    – Mohamed Sacko
    Nov 16 '18 at 15:11











  • you should put your RatingType form in doctor profile and process it in your DoctorController

    – Trix
    Nov 16 '18 at 15:15

















  • Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

    – Mohamed Sacko
    Nov 16 '18 at 12:49











  • please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

    – Trix
    Nov 16 '18 at 12:59











  • Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

    – Mohamed Sacko
    Nov 16 '18 at 15:11











  • you should put your RatingType form in doctor profile and process it in your DoctorController

    – Trix
    Nov 16 '18 at 15:15
















Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

– Mohamed Sacko
Nov 16 '18 at 12:49





Hi, @Trix sorry for my late. I applied your recommendations, And now how to save the vote, when the patient clicks on the number of votes. And I would like to know, it's not anyone who has to click on the stars to vote, it has to be a patient ? Thanks

– Mohamed Sacko
Nov 16 '18 at 12:49













please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

– Trix
Nov 16 '18 at 12:59





please ask separate questions for separate things to help questions and answers more useful to other users. I can not understand your English well, but if you have problem with Patient, replace it with User. you may share your Domain Model if you have detailed questions about that

– Trix
Nov 16 '18 at 12:59













Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

– Mohamed Sacko
Nov 16 '18 at 15:11





Sorry @Trix for my English. But you said I'll need the Rating entity. I did it and now what's next. Knowing that the goal is to allow a patient to note a doctor. Please help me.Thanks

– Mohamed Sacko
Nov 16 '18 at 15:11













you should put your RatingType form in doctor profile and process it in your DoctorController

– Trix
Nov 16 '18 at 15:15





you should put your RatingType form in doctor profile and process it in your DoctorController

– Trix
Nov 16 '18 at 15:15



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53326346%2fhow-to-make-a-simple-star-notation-in-symfony-3%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

How to read a connectionString WITH PROVIDER in .NET Core?

In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

Museum of Modern and Contemporary Art of Trento and Rovereto