/** * @param $id */ public function removeOperation($id) { try { $operation = $this->getNewsItemByOperation($id); $this->em->remove($operation); $this->em->flush(); } catch (\Exception $e) { } }
public function testRemove() { Registry::set('a', 'a'); Registry::set('b', 'b'); Registry::remove('b'); $this->assertEquals(true, Registry::isValidKey('a')); $this->assertEquals(false, Registry::isValidKey('b')); }
/** * Removes the not assigned tokens. * * @param Token[] $tokens */ public function cleanUpUnassignedTokens(array $tokens) { $this->em->clear(); foreach ($tokens as $token) { $token = $this->em->merge($token); $this->em->remove($token); } $this->em->flush(); }
function testDelElement() { $reg = new Registry(); $element = array("numbers" => array(1, 2, 3, 4, 5), "letters" => array("a", "b", "c", "...")); $element2 = array("foo" => "bar"); $reg->add($element); $reg->add($element2); $count = $reg->elementCount(); $reg->remove($element); $count2 = $reg->elementCount(); print "Test delete Element\n"; var_dump($count); var_dump($count2); var_dump($reg); }