예제 #1
0
 /**
  *
  * @param <type> $table
  * @param ArrayIterator $params
  * @return ArrayObject
  */
 public function search($table, ArrayIterator $params)
 {
     $this->searchParams = $params;
     $this->join();
     if ($table == "analysis") {
         $this->statements->remove("type_event");
     }
     $statement = "SELECT this_.* " . $this->selectAttributes() . " FROM {$table} this_ ";
     $statement .= $this->join();
     $i = 0;
     $this->searchParams->rewind();
     if ($this->searchParams->count() > 0 && !$this->searchParams->offsetExists('true')) {
         $statement .= " WHERE ";
     }
     while ($this->searchParams->valid()) {
         if ($this->statements->containsKey($this->searchParams->key())) {
             if ($i++ > 0) {
                 $statement .= " AND ";
             }
             $clause = $this->statements->get($this->searchParams->key());
             $statement .= str_replace(":" . $this->searchParams->key(), "'" . $this->searchParams->current() . "'", $clause['where']);
         }
         $this->searchParams->next();
     }
     return $this->getObject($statement . " ORDER BY this_.date DESC, this_.id DESC");
 }
예제 #2
0
 public function getAllLinesValues()
 {
     $titles = $this->values->get("rowTitles");
     $this->values->remove("rowTitles");
     $valuesToReturn = $this->values->values();
     $this->setTitles($titles);
     return $valuesToReturn;
 }
예제 #3
0
파일: MapTest.php 프로젝트: fwk/xml
 public function testRemovePath()
 {
     $this->object = new Map();
     $path = Path::factory('/test/description', 'description');
     $path2 = Path::factory('/test/properties/property', 'props')->loop(true, '@inexistant');
     $this->object->add(array($path, $path2));
     $this->assertEquals(2, count($this->object->getPaths()));
     $this->object->remove($path);
     $this->assertEquals(1, count($this->object->getPaths()));
 }
예제 #4
0
 /** @test */
 public function removeAffectsGivenKeyOnly()
 {
     $map = new Map(array('foo' => 42, 'bar' => 1337));
     $map->remove('foo');
     $this->assertFalse($map->hasKey('foo'));
     $this->assertEquals(1337, $map->get('bar'));
 }
예제 #5
0
 public function testKeysLocked()
 {
     $map = new Map(['foo6' => 'bar6'], true);
     $success = false;
     try {
         $map->set('foo7', 'bar7');
     } catch (\RuntimeException $e) {
         $success = true;
     }
     $this->assertTrue($success);
     $this->assertTrue($map->remove('foo6')->has('foo6'));
     $this->assertEquals('bar6', $map->set('foo6', 'bar6')->get('foo6'));
     $this->assertEquals(['foo6' => null], $map->clear()->toArray());
 }
 /**
  * @dataProvider provider__construct
  */
 public function test_remove($base, $diff)
 {
     $map = new Map($base);
     foreach ($base as $key => $value) {
         $this->assertEquals($map->get($key), $value);
     }
     foreach ($diff as $key => $value) {
         $map->remove($key);
         unset($base[$key]);
     }
     foreach ($base as $key => $value) {
         $this->assertEquals($map->get($key), $value);
     }
 }