Skip to main content

parse_relation

Function parse_relation 

Source
pub fn parse_relation(
    declaring_class: &str,
    method_name: &str,
    body: Node<'_>,
    source: &str,
) -> Result<Option<Relation>, String>
Expand description

Attempts to read one relationship method’s body as a single return $this-><verb>(...) statement. Ok(None) for a method that isn’t shaped like a relationship at all (skipped silently - not every method on a model is a relationship). Err(reason) for a method that’s clearly attempting a relationship shape this phase doesn’t support (a call to morphTo/hasManyThrough/etc., multiple statements, no bare return, no related-model argument) - flagged, not guessed at.