public static function firstOrNew($id) { if ($entity = self::getDataMapperInstance()->first($id)) { return $entity; } $entity = new static(); $entity->_id = $id; return $entity; }