Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 00da788

Browse filesBrowse files
committed
[Validator] Added the missing PHP format in a code example
1 parent e5e04ff commit 00da788
Copy full SHA for 00da788

File tree

Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+16
-0
lines changed

‎validation/custom_constraint.rst

Copy file name to clipboardExpand all lines: validation/custom_constraint.rst
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,3 +234,19 @@ not to the property:
234234
<class name="AppBundle\Entity\AcmeEntity">
235235
<constraint name="AppBundle\Validator\Constraints\ProtocolClass"/>
236236
</class>
237+
238+
.. code-block:: php
239+
240+
// src/AppBundle/Entity/AcmeEntity.php
241+
use AppBundle\Validator\Constraints\ProtocolClass;
242+
use Symfony\Component\Validator\Mapping\ClassMetadata;
243+
244+
class AcmeEntity
245+
{
246+
// ...
247+
248+
public static function loadValidatorMetadata(ClassMetadata $metadata)
249+
{
250+
$metadata->addConstraint(new ProtocolClass());
251+
}
252+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.