Skip to content

Commit 2ec4192

Browse files
committed
Merge branch '3.0' into 3.1
* 3.0: Remove old File Upload article + improve the new one Added documentation for the Ldap component
2 parents 0e71066 + ad76b72 commit 2ec4192

File tree

14 files changed

+898
-619
lines changed

14 files changed

+898
-619
lines changed

book/forms.rst

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1917,19 +1917,18 @@ HTML form so that the user can modify that data. The second goal of a form is to
19171917
take the data submitted by the user and to re-apply it to the object.
19181918

19191919
There's still much more to learn about the powerful world of forms, such as
1920-
how to handle
1921-
:doc:`file uploads with Doctrine </cookbook/doctrine/file_uploads>` or how
1922-
to create a form where a dynamic number of sub-forms can be added (e.g. a
1923-
todo list where you can keep adding more fields via JavaScript before submitting).
1920+
how to handle :doc:`file uploads </cookbook/controller/upload_file>` or how to
1921+
create a form where a dynamic number of sub-forms can be added (e.g. a todo
1922+
list where you can keep adding more fields via JavaScript before submitting).
19241923
See the cookbook for these topics. Also, be sure to lean on the
19251924
:doc:`field type reference documentation </reference/forms/types>`, which
19261925
includes examples of how to use each field type and its options.
19271926

19281927
Learn more from the Cookbook
19291928
----------------------------
19301929

1931-
* :doc:`/cookbook/doctrine/file_uploads`
1932-
* :doc:`FileType Reference </reference/forms/types/file>`
1930+
* :doc:`/cookbook/controller/upload_file`
1931+
* :doc:`File Field Reference </reference/forms/types/file>`
19331932
* :doc:`Creating Custom Field Types </cookbook/form/create_custom_field_type>`
19341933
* :doc:`/cookbook/form/form_customization`
19351934
* :doc:`/cookbook/form/dynamic_form_modification`

components/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The Components
2222
http_foundation/index
2323
http_kernel/index
2424
intl
25+
ldap
2526
options_resolver
2627
phpunit_bridge
2728
process

components/ldap.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
.. index::
2+
single: Ldap
3+
single: Components; Ldap
4+
5+
The Ldap Component
6+
==================
7+
8+
The Ldap component provides a means to connect to an LDAP server (OpenLDAP or Active Directory).
9+
10+
Installation
11+
------------
12+
13+
You can install the component in 2 different ways:
14+
15+
* :doc:`Install it via Composer </components/using_components>` (``symfony/ldap`` on `Packagist`_);
16+
* Use the official Git repository (https://github.com/symfony/ldap).
17+
18+
.. include:: /components/require_autoload.rst.inc
19+
20+
Usage
21+
-----
22+
23+
The :class:`Symfony\\Component\\Ldap\\LdapClient` class provides methods
24+
to authenticate and query against an LDAP server.
25+
26+
The :class:`Symfony\\Component\\Ldap\\LdapClient` class can be configured
27+
using the following options:
28+
29+
``host``
30+
IP or hostname of the LDAP server
31+
32+
``port``
33+
Port used to access the LDAP server
34+
35+
``version``
36+
The version of the LDAP protocol to use
37+
38+
``useSsl``
39+
Whether or not to secure the connection using SSL
40+
41+
``useStartTls``
42+
Whether or not to secure the connection using StartTLS
43+
44+
``optReferrals``
45+
Specifies whether to automatically follow referrals
46+
returned by the LDAP server
47+
48+
For example, to connect to a start-TLS secured LDAP server::
49+
50+
use Symfony\Component\Ldap\LdapClient;
51+
52+
$ldap = new LdapClient('my-server', 389, 3, false, true);
53+
54+
The :method:`Symfony\\Component\\Ldap\\LdapClient::bind` method
55+
authenticates a previously configured connection using both the
56+
distinguished name (DN) and the password of a user::
57+
58+
use Symfony\Component\Ldap\LdapClient;
59+
// ...
60+
61+
$ldap->bind($dn, $password);
62+
63+
Once bound (or if you enabled anonymous authentication on your
64+
LDAP server), you may query the LDAP server using the
65+
:method:`Symfony\\Component\\Ldap\\LdapClient::find` method::
66+
67+
use Symfony\Component\Ldap\LdapClient;
68+
// ...
69+
70+
$ldap->find('dc=symfony,dc=com', '(&(objectclass=person)(ou=Maintainers))');
71+
72+
.. _Packagist: https://packagist.org/packages/symfony/ldap

components/map.rst.inc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@
112112

113113
* :doc:`/components/intl`
114114

115+
* **Ldap**
116+
117+
* :doc:`/components/ldap`
118+
115119
* **OptionsResolver**
116120

117121
* :doc:`/components/options_resolver`

0 commit comments

Comments
 (0)