@@ -31,3 +31,41 @@ $registry->addFieldResolver('Query', 'currentUser', $builder->compose(
3131 })
3232));
3333```
34+
35+ ## Debugging producers
36+
37+ Note that you can always easily tap into the chain and e.g. use xdebug to debug the values:
38+
39+ ```
40+ $builder->compose(
41+ $builder->tap($builder->callback(function ($parent, $args) {
42+ // YOU CAN SET A XDEBUG BREAKPOINT IN THESE CALLBACKS TO CHECK THE VALUES.
43+ echo("Compose step 0.");
44+ })),
45+ // Load the file object from the field.
46+ $builder->produce('property_path')
47+ ->map('type', $builder->fromValue('entity:YOUR_ENTITY_TYPE'))
48+ ->map('value', $builder->fromParent())
49+ ->map('path', $builder->fromValue('YOUR_FIELD_NAME.YOUR_FIELD_PROPERTY')),
50+ $builder->tap($builder->callback(function ($parent, $args) {
51+ // YOU CAN SET A XDEBUG BREAKPOINT IN THESE CALLBACKS TO CHECK THE VALUES.
52+ echo("Compose step 1.");
53+ })),
54+ // Load the image style derivative of the file.
55+ $builder->produce('image_derivative')
56+ ->map('entity', $builder->fromParent())
57+ ->map('style', $builder->fromValue('YOUR_IMAGE_STYLE')),
58+ $builder->tap($builder->callback(function ($parent, $args) {
59+ // YOU CAN SET A XDEBUG BREAKPOINT IN THESE CALLBACKS TO CHECK THE VALUES.
60+ echo("Compose step 2.");
61+ })),
62+ // Retrieve the url of the generated image.
63+ $builder->produce('image_style_url')
64+ ->map('derivative', $builder->fromParent()),
65+ $builder->tap($builder->callback(function ($parent, $args) {
66+ // YOU CAN SET A XDEBUG BREAKPOINT IN THESE CALLBACKS TO CHECK THE VALUES.
67+ echo("Compose step 3.");
68+ }))
69+ )
70+ );
71+ ```
0 commit comments