public function setEntity($entity_id)
    {
        if ($entity_id instanceof Entity)
        {
            $this->entity = $entity_id;
            $entity_id = $entity_id->getID();
        }
        elseif (!is_scalar($entity_id))
            throw new Exception("Entity-ID must be an Entity or a scalar");

        if ($entity_id !== $this->entity_id)
        {
            $this->entity_id = $entity_id;
            $this->changed = true;
        }
    }