Changeset 11848
- Timestamp:
- 08/30/07 11:30:56 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/midcom/baseclasses/database/article.php
r4739 r11848 48 48 return true; 49 49 } 50 51 $ qb = midcom_baseclasses_database_article::new_query_builder();52 $ qb->add_constraint('name', '=', $this->name);53 50 51 $mc = midcom_baseclasses_database_article::new_collector('name', $this->name); 52 $mc->add_constraint('name', '=', $this->name); 53 54 54 if ($this->id) 55 55 { 56 $ qb->add_constraint('id', '<>', $this->id);57 } 58 56 $mc->add_constraint('id', '<>', $this->id); 57 } 58 59 59 if ($this->up != 0) 60 60 { 61 61 // "Reply article", we care only about the up field 62 $ qb->add_constraint('up', '=', $this->up);62 $mc->add_constraint('up', '=', $this->up); 63 63 } 64 64 else 65 65 { 66 66 // Toplevel article, check topic 67 $ qb->add_constraint('topic', '=', $this->topic);68 } 69 67 $mc->add_constraint('topic', '=', $this->topic); 68 } 69 70 70 // Run the uniqueness check 71 $matches = $qb->execute_unchecked(); 72 if (count($matches) > 0) 71 if ($mc->count > 0) 73 72 { 74 73 // This name is already taken
