public function testConfigModeMultiValue()
 {
     $options = array('id' => array(1, 2), 'query' => array('id:1', 'id:2'));
     $command = new Solarium_Query_Update_Command_Delete($options);
     $this->assertEquals(array(1, 2), $command->getIds());
     $this->assertEquals(array('id:1', 'id:2'), $command->getQueries());
 }
Example #2
0
 /**
  * Build XML for a delete command
  *
  * @param Solarium_Query_Update_Command_Delete $command
  * @return string
  */
 public function buildDeleteXml($command)
 {
     $xml = '<delete>';
     foreach ($command->getIds() as $id) {
         $xml .= '<id>' . htmlspecialchars($id, ENT_NOQUOTES, 'UTF-8') . '</id>';
     }
     foreach ($command->getQueries() as $query) {
         $xml .= '<query>' . htmlspecialchars($query, ENT_NOQUOTES, 'UTF-8') . '</query>';
     }
     $xml .= '</delete>';
     return $xml;
 }
 public function testBuildDeleteXmlIdAndQuerySpecialChars()
 {
     $command = new Solarium_Query_Update_Command_Delete();
     $command->addId('special<char>id');
     $command->addQuery('id:special<char>id');
     $this->assertEquals('<delete><id>special&lt;char&gt;id</id><query>id:special&lt;char&gt;id</query></delete>', $this->_builder->buildDeleteXml($command));
 }
Example #4
0
 /**
  * Convenience method to add a delete by IDs command
  *
  * If you need more control, like choosing a key for the command you need to
  * create you own command instance and use the add method.
  *
  * @param array $ids
  * @return Solarium_Query_Update Provides fluent interface
  */
 public function addDeleteByIds($ids)
 {
     $delete = new Solarium_Query_Update_Command_Delete();
     $delete->addIds($ids);
     return $this->add(null, $delete);
 }