From 8e2a27655ecad2c1f98889d15168c3a55c24fa67 Mon Sep 17 00:00:00 2001 From: PastorMickael Date: Fri, 24 Feb 2017 11:39:28 +0100 Subject: [PATCH] Update validation.rst --- en/orm/validation.rst | 2 ++ 1 file changed, 2 insertions(+) diff --git a/en/orm/validation.rst b/en/orm/validation.rst index dd897d69e2..568bea03e0 100644 --- a/en/orm/validation.rst +++ b/en/orm/validation.rst @@ -411,6 +411,7 @@ Association Count Rules If you need to validate that a property or association contains the correct number of values, you can use the ``validCount()`` rule:: + // In the ArticleTable.php file // No more than 5 tags on an article. $rules->add($rules->validCount('tags', 5, '<=', 'You can only have 5 tags')); @@ -419,6 +420,7 @@ comparison operator to use. ``==``, ``>=``, ``<=``, ``>``, ``<``, and ``!=`` are the accepted operators. To ensure a property's count is within a range, use two rules:: + // In the ArticleTable.php file // Between 3 and 5 tags $rules->add($rules->validCount('tags', 3, '>=', 'You must have at least 3 tags')); $rules->add($rules->validCount('tags', 5, '<=', 'You must have at most 5 tags'));