function add($key, $value, $ttl = false) { $resolved_key = $this->_resolveKey($key); try { $this->db_table->insert(array('key' => $resolved_key, 'value' => lmbSerializable::serialize($value), 'ttl' => $ttl += time())); return true; } catch (Exception $e) { return false; } }
protected function _saveObject($object, $error_list = null) { $object->save($error_list); $table = new lmbTableGateway($this->relation_info['table'], $this->conn); $table->insert(array($this->relation_info['field'] => $this->owner->getId(), $this->relation_info['foreign_field'] => $object->getId())); }
function testRemoveAllDeletesOnlyProperRecordsFromTable() { $group1 = $this->_initGroup(); $group2 = $this->_initGroup(); $user = new UserForTestWithSpecialRelationTable(); $user->setFirstName('User' . mt_rand()); $user->save(); $collection = new lmbARManyToManyCollection('groups', $user); $collection->add($group1); $collection->add($group2); $db_table = new lmbTableGateway('extended_user_for_test2group_for_test'); $db_table->insert(array('user_id' => $user->getId(), 'other_id' => 100)); $collection->removeAll(); $this->assertEqual($db_table->select()->count(), 1); }
protected function _initCmsDocumentTable() { $table = new lmbTableGateway('lmb_cms_document'); $root = array('parent_id' => 0, 'identifier' => '', 'uri' => '/'); $table->insert($root); }