public function preUp()
 {
     $conn = Doctrine_Manager::getInstance()->getConnectionForComponent('CommunityeMember');
     $results = $conn->fetchAll('SELECT id, member_id, community_id, position from community_member where position <> ? AND position IS NOT NULL', array(''));
     foreach ($results as $result) {
         if (isset($result['position']) && $result['position'] && $result['position'] !== 'pre') {
             $communityMemberPosition = new CommunityMemberPosition();
             $communityMemberPosition->setMemberId($result['member_id']);
             $communityMemberPosition->setCommunityId($result['community_id']);
             $communityMemberPosition->setCommunityMemberId($result['id']);
             $communityMemberPosition->setName($result['position']);
             $communityMemberPosition->save();
         }
     }
 }
 public function addPosition($name)
 {
     $object = null;
     if (!$this->isNew()) {
         $object = Doctrine::getTable('CommunityMemberPosition')->findOneByCommunityMemberIdAndName($this->getId(), $name);
     }
     if (!$object) {
         $object = new CommunityMemberPosition();
         $object->setMemberId($this->getMemberId());
         $object->setCommunityId($this->getCommunityId());
         $object->setCommunityMember($this);
         $object->setName($name);
         $object->save();
     }
 }