Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Add new validator config & translations path#8633

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
weaverryan merged 1 commit intosymfony:masterfromyceruto:validator_paths
Nov 16, 2017
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletionsvalidation.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -59,15 +59,15 @@ following:

.. code-block:: yaml

#src/Resources/config/validation.yml
# config/validator/validation.yaml
App\Entity\Author:
properties:
name:
- NotBlank: ~

.. code-block:: xml

<!--src/Resources/config/validation.xml -->
<!-- config/validator/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand DownExpand Up@@ -214,13 +214,13 @@ file:

.. code-block:: yaml

#app/config/config.yml
# config/packages/framework.yaml
framework:
validation: { enabled: true }

.. code-block:: xml

<!--app/config/config.xml -->
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All@@ -236,7 +236,7 @@ file:

.. code-block:: php

//app/config/config.php
// config/packages/framework.php
$container->loadFromExtension('framework', array(
'validation' => array(
'enabled' => true,
Expand All@@ -250,13 +250,13 @@ previous configuration by the following:

.. code-block:: yaml

#app/config/config.yml
# config/packages/framework.yml
framework:
validation: { enable_annotations: true }

.. code-block:: xml

<!--app/config/config.xml -->
<!-- config/packages/framework.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand All@@ -272,7 +272,7 @@ previous configuration by the following:

.. code-block:: php

//app/config/config.php
// config/packages/framework.php
$container->loadFromExtension('framework', array(
'validation' => array(
'enable_annotations' => true,
Expand DownExpand Up@@ -346,7 +346,7 @@ literature genre mostly associated with the author, which can be set to either

.. code-block:: yaml

#src/Resources/config/validation.yml
# config/validator/validation.yaml
App\Entity\Author:
properties:
genre:
Expand All@@ -355,7 +355,7 @@ literature genre mostly associated with the author, which can be set to either

.. code-block:: xml

<!--src/Resources/config/validation.xml -->
<!-- config/validator/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand DownExpand Up@@ -430,7 +430,7 @@ options can be specified in this way.

.. code-block:: yaml

#src/Resources/config/validation.yml
# config/validator/validation.yml
App\Entity\Author:
properties:
genre:
Expand All@@ -439,7 +439,7 @@ options can be specified in this way.

.. code-block:: xml

<!--src/Resources/config/validation.xml -->
<!-- config/validator/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand DownExpand Up@@ -559,7 +559,7 @@ class to have at least 3 characters.

.. code-block:: yaml

#src/Resources/config/validation.yml
# config/validator/validation.yaml
App\Entity\Author:
properties:
firstName:
Expand All@@ -569,7 +569,7 @@ class to have at least 3 characters.

.. code-block:: xml

<!--src/Resources/config/validation.xml -->
<!-- config/validator/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand DownExpand Up@@ -647,15 +647,15 @@ this method must return ``true``:

.. code-block:: yaml

#src/Resources/config/validation.yml
# config/validator/validation.yaml
App\Entity\Author:
getters:
passwordLegal:
- 'IsTrue': { message: 'The password cannot match your first name' }

.. code-block:: xml

<!--src/Resources/config/validation.xml -->
<!-- config/validator/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand Down
12 changes: 6 additions & 6 deletionsvalidation/translations.rst
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -40,15 +40,15 @@ property is not empty, add the following:

.. code-block:: yaml

#src/Resources/config/validation.yml
# config/validator/validation.yaml
App\Entity\Author:
properties:
name:
- NotBlank: { message: 'author.name.not_blank' }

.. code-block:: xml

<!--src/Resources/config/validation.xml -->
<!-- config/validator/validation.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
Expand DownExpand Up@@ -84,13 +84,13 @@ property is not empty, add the following:
}
}

Now, create a ``validators`` catalog file in the ``app/Resources/translations`` directory:
Now, create a ``validators`` catalog file in the ``config/translations/`` directory:

.. configuration-block::

.. code-block:: xml

<!--app/Resources/translations/validators.en.xlf -->
<!--config/translations/validators.en.xlf -->
<?xml version="1.0"?>
<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
<file source-language="en" datatype="plaintext" original="file.ext">
Expand All@@ -105,12 +105,12 @@ Now, create a ``validators`` catalog file in the ``app/Resources/translations``

.. code-block:: yaml

#app/Resources/translations/validators.en.yml
#config/translations/validators.en.yaml
author.name.not_blank: Please enter an author name.

.. code-block:: php

//app/Resources/translations/validators.en.php
//config/translations/validators.en.php
return array(
'author.name.not_blank' => 'Please enter an author name.',
);
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp