Example #1
0
 /**
  * Merges collection into $this and returns merged collection
  * 
  * @param Doctrine_Collection $coll
  * @return Doctrine_Collection
  */
 public function merge(Doctrine_Collection $coll)
 {
     $localBase = $this->getTable()->getComponentName();
     $otherBase = $coll->getTable()->getComponentName();
     if ($otherBase != $localBase && !is_subclass_of($otherBase, $localBase)) {
         throw new Doctrine_Collection_Exception("Can't merge collections with incompatible record types");
     }
     foreach ($coll->getData() as $record) {
         $this->add($record);
     }
     return $this;
 }
Example #2
0
 public function search(Doctrine_Record $record, Doctrine_Collection $coll)
 {
     return array_search($record, $coll->getData(), true);
 }