Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -43,6 +43,26 @@ |
44 | 44 | } |
45 | 45 | |
46 | 46 | /** |
| 47 | + * (non-PHPdoc) |
| 48 | + * @see EPDBObject::removeFromDB() |
| 49 | + */ |
| 50 | + public function removeFromDB() { |
| 51 | + $id = $this->getId(); |
| 52 | + |
| 53 | + $success = parent::removeFromDB(); |
| 54 | + |
| 55 | + if ( $success ) { |
| 56 | + $success = wfGetDB( DB_MASTER )->delete( 'ep_mentors_per_org', array( 'mpo_org_id' => $id ) ) && $success; |
| 57 | + |
| 58 | + foreach ( EPCourse::select( 'id', array( 'org_id' => $id ) ) as /* EPCourse */ $course ) { |
| 59 | + $success = $course->removeFromDB() && $success; |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + return $success; |
| 64 | + } |
| 65 | + |
| 66 | + /** |
47 | 67 | * Returns a list of orgs in an array that can be fed to select inputs. |
48 | 68 | * |
49 | 69 | * @since 0.1 |
Index: trunk/extensions/EducationProgram/includes/EPTerm.php |
— | — | @@ -43,5 +43,21 @@ |
44 | 44 | 'end' => wfTimestamp( TS_MW ), |
45 | 45 | ); |
46 | 46 | } |
| 47 | + |
| 48 | + /** |
| 49 | + * (non-PHPdoc) |
| 50 | + * @see EPDBObject::removeFromDB() |
| 51 | + */ |
| 52 | + public function removeFromDB() { |
| 53 | + $id = $this->getId(); |
| 54 | + |
| 55 | + $success = parent::removeFromDB(); |
| 56 | + |
| 57 | + if ( $success ) { |
| 58 | + $success = wfGetDB( DB_MASTER )->delete( 'ep_students_per_term', array( 'spt_term_id' => $id ) ) && $success; |
| 59 | + } |
| 60 | + |
| 61 | + return $success; |
| 62 | + } |
47 | 63 | |
48 | 64 | } |
Index: trunk/extensions/EducationProgram/includes/EPDBObject.php |
— | — | @@ -732,7 +732,7 @@ |
733 | 733 | * @return array of self |
734 | 734 | */ |
735 | 735 | public static function select( $fields = null, array $conditions = array(), array $options = array(), array $joinConds = array() ) { |
736 | | - $result = static::selectFields( $fields, $conditions, $options, $joinConds ); |
| 736 | + $result = static::selectFields( $fields, $conditions, $options, $joinConds, false ); |
737 | 737 | |
738 | 738 | $objects = array(); |
739 | 739 | |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -42,6 +42,24 @@ |
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
| 46 | + * (non-PHPdoc) |
| 47 | + * @see EPDBObject::removeFromDB() |
| 48 | + */ |
| 49 | + public function removeFromDB() { |
| 50 | + $id = $this->getId(); |
| 51 | + |
| 52 | + $success = parent::removeFromDB(); |
| 53 | + |
| 54 | + if ( $success ) { |
| 55 | + foreach ( EPTerm::select( 'id', array( 'course_id' => $id ) ) as /* EPTerm */ $term ) { |
| 56 | + $success = $term->removeFromDB() && $success; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + return $success; |
| 61 | + } |
| 62 | + |
| 63 | + /** |
46 | 64 | * Returns a list of courses in an array that can be fed to select inputs. |
47 | 65 | * |
48 | 66 | * @since 0.1 |