Pārlūkot izejas kodu

added example of virtualproperty with changing order

Jaap van Otterdijk 12 gadi atpakaļ
vecāks
revīzija
a23d9cfe66
1 mainītis faili ar 22 papildinājumiem un 0 dzēšanām
  1. 22 0
      doc/reference/annotations.rst

+ 22 - 0
doc/reference/annotations.rst

@@ -147,6 +147,28 @@ default the order is undefined, but you may change it to either "alphabetical",
         private $name;
     }
 
+    /**
+     * @AccessorOrder("custom", custom = {"name", "SomeMethod" ,"id"})
+     *
+     * Resulting Property Order: name, mood, id
+     */
+    class User
+    {
+        private $id;
+        private $name;
+
+        /**
+         * @Serializer\VirtualProperty
+         * @Serializer\SerializedName("mood")
+         *
+         * @return string
+         */
+        public function getSomeMethod()
+        {
+            return 'happy';
+        }
+    }
+
 @VirtualProperty
 ~~~~~~~~~~~~~~~~
 This annotation can be defined on a method to indicate that the data returned by