/** * Returns the object from the set * * Required by interface ArrayAccess * * @param ObjectHandlable $object * @return ObjectHandlable * @throws \InvalidArgumentException if the object doesn't implement ObjectHandlable */ public function offsetGet($object) { if (!$object instanceof ObjectHandlable) { throw new \InvalidArgumentException('Object needs to implement ObjectHandlable'); } return $this->_object_set->offsetGet($object->getHandle()); }
/** * Removes a row from the rowset * * The row will be removed based on it's identity_column if set or otherwise by * it's object handle. * * @param DatabaseRowInterface $row * @return DatabaseRowsetAbstract * @throws \InvalidArgumentException if the object doesn't implement DatabaseRowInterface */ public function extract(ObjectHandlable $row) { if (!$row instanceof DatabaseRowInterface) { throw new \InvalidArgumentException('Row needs to implement DatabaseRowInterface'); } if (isset($this->_identity_column)) { $handle = $row->{$this->_identity_column}; } else { $handle = $row->getHandle(); } if ($this->_object_set->offsetExists($handle)) { $this->_object_set->offsetUnset($handle); } return $this; }
/** * Check if the queue does contain a given object * * @param ObjectHandlable $object * @return bool */ public function contains(ObjectHandlable $object) { $result = false; if ($handle = $object->getHandle()) { $result = $this->_object_list->offsetExists($handle); } return $result; }
/** * Removes an object from the set * * Required by interface ArrayAccess * * @param ObjectHandlable $object * @return ObjectSet * @throws \InvalidArgumentException if the object doesn't implement the ObjectHandlable interface */ public function offsetUnset($object) { if (!$object instanceof ObjectHandlable) { throw new \InvalidArgumentException('Object needs to implement ObjectHandlable'); } unset($this->__data[$object->getHandle()]); return $this; }