This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

Problem with method Answer::getRelevancyUp() on askeet Day 4

Discussion around this tutorial for symfony 1.0.x

Problem with method Answer::getRelevancyUp() on askeet Day 4

by Lemahdois » Wed Apr 22, 2009 5:36 pm

Hello i'm beginner in symfony, i'm get to the 4th day and now i have a problem which is not letting me to continue.
in fact after modifying my yml file schema.yml as described down,
Code: Select all
propel:
  _attributes:   { noXsd: false, defaultIdMethod: none, package: lib.model }
 
  ask_question:
    _attributes: { phpName: Question, idMethod: native }
    id:          { type: integer, required: true, primaryKey: true, autoIncrement: true }
    user_id:     { type: integer, foreignTable: ask_user, foreignReference: id }
    title:       { type: longvarchar }
    body:        { type: longvarchar }
    interested_users:        { type: integer }
    created_at:  ~
    updated_at:  ~
 
  ask_answer:
    _attributes: { phpName: Answer, idMethod: native }
    id:          { type: integer, required: true, primaryKey: true, autoIncrement: true }
    question_id: { type: integer, foreignTable: ask_question, foreignReference: id }
    user_id:     { type: integer, foreignTable: ask_user, foreignReference: id }
    body:        { type: longvarchar }
    created_at:  ~
 
  ask_user:
    _attributes: { phpName: User, idMethod: native }
    id:          { type: integer, required: true, primaryKey: true, autoIncrement: true }
    nickname:    { type: varchar(50), required: true, index: true }
    first_name:  varchar(100)
    last_name:   varchar(100)
    created_at:  ~
 
  ask_interest:
    _attributes: { phpName: Interest, idMethod: native }
    question_id: { type: integer, foreignTable: ask_question, foreignReference: id, primaryKey: true }
    user_id:     { type: integer, foreignTable: ask_user, foreignReference: id, primaryKey: true }
    created_at:  ~
 
  ask_relevancy:
    _attributes: { phpName: Relevancy, idMethod: native }
    answer_id:   { type: integer, foreignTable: ask_answer, foreignReference: id, primaryKey: true }
    user_id:     { type: integer, foreignTable: ask_user, foreignReference: id, primaryKey: true }
    relevancy_up: { type: integer }
    relevancy_down: { type: integer }
    score:       { type: integer }
    created_at:  ~
   



adding the function save in class Relevancy and adding the two functions getRelevancyUpPercent() and getRelevancyDownPercent()
to the class answer
I added also some test values to the file test_data.yml as described here:
Code: Select all
User:
  anonymous:
    nickname:   anonymous
    first_name: Anonymous
    last_name:  Coward

  fabien:
    nickname:   fabpot
    first_name: Fabien
    last_name:  Potencier

  francois:
    nickname:   francoisz
    first_name: Fran├žois
    last_name:  Zaninotto

Question:
  q1:
    title: What shall I do tonight with my girlfriend?
    user_id: fabien
    body:  |
      We shall meet in front of the Dunkin'Donuts before dinner,
      and I haven't the slightest idea of what I can do with her.
      She's not interested in programming, space opera movies nor insects.
      She's kinda cute, so I really need to find something
      that will keep her to my side for another evening.

  q2:
    title: What can I offer to my step mother?
    user_id: anonymous
    body:  |
      My stepmother has everything a stepmother is usually offered
      (watch, vacuum cleaner, earrings, del.icio.us account).
      Her birthday comes next week, I am broke, and I know that
      if I don't offer her something sweet, my girlfriend
      won't look at me in the eyes for another month.

  q3:
    title: How can I generate traffic to my blog?
    user_id: francois
    body:  |
      I have a very swell blog that talks
      about my class and mates and pets and favorite movies.

Interest:
  i1: { user_id: fabien, question_id: q1 }
  i2: { user_id: francois, question_id: q1 }
  i3: { user_id: francois, question_id: q2 }
  i4: { user_id: fabien, question_id: q2 }
Answer:
  a1_q1:
    question_id: q1
    user_id:     francois
    body:        |
      You can try to read her poetry. Chicks love that kind of things.

  a2_q1:
    question_id: q1
    user_id:     fabien
    body:        |
      Don't bring her to a donuts shop. Ever. Girls don't like to be
      seen eating with their fingers - although it's nice.

  a3_q2:
    question_id: q2
    user_id:     fabien
    body:        |
      The answer is in the question: buy her a step, so she can
      get some exercise and be grateful for the weight she will
      lose.

  a4_q3:
    question_id: q3
    user_id:     fabien
    body:        |
      Build it with symfony - and people will love it.
Relevancy:
  rel1:
    answer_id: a1_q1
    user_id:   fabien
    score:     1

  rel2:
    answer_id: a1_q1
    user_id:   francois
    score:     -1
     


I rebuild the model ,and sql but the problem is that i don't have the function getRelevancyUp() in BaseAnswer.php and that's what is generating the bug Fatal error: Call to undefined method Answer::getRelevancyUp() in /var/www/sfprojects/askeet/lib/model/Answer.php on line 14
did someoone can tell me why i'm not getting the new methods of the answer class when regenerating the model?
Lemahdois
Junior Member
 
Posts: 2
Joined: Wed Apr 22, 2009 5:13 pm
Location: Tunisia