public function getter($key)
    {
        $property = $this;

        return function($object) use ($key, $property) {
            $value = $object->get($key);

            if (is_null($value) && $property->type->options()->primary) {
                return $property->reference($object);
            } else {
                return $value;
            }
        };
    }
public function getter($key)
    {
        $property = $this;

        return function($object) use ($key, $property) {
            $value = $object->get($key);

            if (is_null($value) && $property->type->options()->primary) {
                return $property->reference($object);
            } else {
                return $value;
            }
        };
    }
public function getter ( $ key ) { $ property = $ this ; return function ( $ object ) use ( $ key , $ property ) { $ value = $ object -> get ( $ key ) ; if ( is_null ( $ value ) && $ property -> type -> options ( ) -> primary ) { return $ property -> reference ( $ object ) ; } else { return $ value ; } } ; }
Return a closure for accessing the value of the property
@return closure
Return a closure for accessing the value of the property