Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm not aware of any syntax that can give you additional <em>structural element definition</em> about the JSON strings you have in play here. I can address some basic thoughts though.</p> <p>Since no explicit arguments are passed to edit(), no @param tags should be used anyway. At best, maybe include a "@uses UserController::$request" with a description that explains how its $data array should find any "arguments for edit() to act on" in $data's ['args'] key. Explaining the needed info about ['args'] and its structure would have to be pure text description. There is no point in having some kind of "structured documentation layout" here... such doc elements only exist to 1) be linked to from other docs, 2) affect doc layout format when displaying the element. I guess I'd approach it like this, in the docblock for edit():</p> <pre><code>* @uses UserController::$request * $request has its own $data array, whose ['args'] key * should contain a JSON value. In the JSON, keys represent * the fields to edit, values are the new values. </code></pre> <p>As for the return, since there is an actual return here rather than just behind-the-scenes modifications being done, I would use a true @return tag:</p> <pre><code>* @return string JSON that indicates success/failure of the update, * or JSON that indicates an error occurred. </code></pre> <p>You can certainly expand on this by displaying examples of the JSON strings at each point, but aside from the docs being able to render the JSON like actual JSON rather than just text, I don't see what else you could be after. I'd likely choose to display only the status return JSON examples in the docblock's Long Description, and refer the reader to the docs for the createError() method to see the error JSON layout, rather than trying to cram them all into the tags.</p> <pre><code>/** * edit() method * * The edit() method examines values already set elsewhere, acts on the edits requested * by those values, and returns an indication of whether or not the edits succeeded. * * An array key of $data['args'] must be set in the UserController::$request object. * It must contain a JSON string that lists the fields to update and the values to use. * * Example: * &lt;code&gt; * { * "id": 1 * "first_name": "John" * "last_name": "Doe" * } * &lt;/code&gt; * * "id" is required, while other fields are optional. * * The JSON string that is returned by edit() will normally indicate whether or not * the edits were performed successfully. * * Success: * &lt;code&gt; * { * "status": 1 * } * &lt;/code&gt; * Failure: * &lt;code&gt; * { * "status": 0 * } * &lt;/code&gt; * * In the case of validation errors with the values used in the updates, * a JSON error string would be returned, in the format generated * by the createError() method. * * @return string JSON that indicates success/failure of the update, * or JSON that indicates an error occurred. * * @uses UserController::$request * @see UserController::createError() */ </code></pre> <p>You may feel like this is a lot to put in there, but you have to understand that you're trying to explain some behind-the-scenes voodoo to the coder/consumer that's reading the doc. Rather than calling the method with direct arguments, you're having to explain how the user must provide arguments in a roundabout way. The verbosity in the long description goes a long way to avoid the user feeling like he's missing something in understanding how to correctly use that edit() method.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload