Add Medals field to profile
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Fri, 19 Mar 2010 23:11:33 +0000 (00:11 +0100)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Mon, 22 Mar 2010 12:49:29 +0000 (13:49 +0100)
Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/profile.php

index 8af99ab..032c61a 100644 (file)
@@ -482,6 +482,24 @@ class Profile
                                   WHERE  pid = {?}', $this->id());
     }
 
+    /* Medals
+     */
+    private $medals = null;
+    public function setMedals(ProfileMedals $medals)
+    {
+        $this->medals = $medals;
+    }
+
+    public function getMedals()
+    {
+        if ($this->medals == null) {
+            $this->setMedals($this->getProfileField('ProfileMedals'));
+        }
+        if ($this->medals == null) {
+            return array();
+        }
+        return $this->medals->medals;
+    }
 
     public function owner()
     {
@@ -831,7 +849,7 @@ class ProfileIterator implements PlIterator
             $pf->setCorps($vals[Profile::FETCH_CORPS]);
         }
         if ($this->hasData(Profile::FETCH_EDU, $vals)) {
-            $pf->setEdu($vals[Profile::FETCH_EDU]);
+            $pf->setEducations($vals[Profile::FETCH_EDU]);
         }
         if ($this->hasData(Profile::FETCH_MEDALS, $vals)) {
             $pf->setMedals($vals[Profile::FETCH_MEDALS]);