function cast($obj = NULL) { if (!$obj) { $obj = $this; } return $obj->document + ['_id' => $this->id]; }