Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Documented how to add or remove values of multi-valued attributes #9553

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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2018

Conversation

jean-gui
Copy link
Contributor

@jean-gui jean-gui commented Apr 4, 2018

@xabbuh xabbuh added this to the 4.1 milestone Apr 10, 2018
@@ -129,6 +129,10 @@ delete existing ones::
$entry = $result[0];
$entry->setAttribute('email', array('[email protected]'));
$entityManager->update($entry);

// Adding or removing values to a multi-valued attribute is more efficient than using update()
$entityManager->addAttributeValues($entry, 'telephoneNumber', ['+1.111.222.3333', '+1.222.333.4444']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency please us the long array notation here.

@xabbuh xabbuh added the Ldap label Apr 10, 2018
@xabbuh
Copy link
Member

xabbuh commented Apr 10, 2018

I would also add a versionadded directive below to explain that these methods are new:

.. versionadded:: 4.1
    The ``addAttributeValues()`` and ``removeAttributeValues()`` methods
    were introduced in Symfony 4.1.

@jean-gui
Copy link
Contributor Author

@xabbuh Done.


// Removing an existing entry
$entityManager->remove(new Entry('cn=Test User,dc=symfony,dc=com'));

.. versionadded:: 4.1
The ``addAttributeValues()`` and ``removeAttributeValues()`` methods
were introduced in Symfony 4.1.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need a blank line after this paragraph to have it rendered correctly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added it.

@javiereguiluz
Copy link
Member

@jean-gui thanks for adding this missing docs. It was a nice first contribution to Symfony Docs!

@javiereguiluz javiereguiluz merged commit 40df041 into symfony:master Apr 16, 2018
javiereguiluz added a commit that referenced this pull request Apr 16, 2018
…tributes (jean-gui)

This PR was merged into the master branch.

Discussion
----------

Documented how to add or remove values of multi-valued attributes

Related to symfony/symfony#21856

<!--

If your pull request fixes a BUG, use the oldest maintained branch that contains
the bug (see https://symfony.com/roadmap for the list of maintained branches).

If your pull request documents a NEW FEATURE, use the same Symfony branch where
the feature was introduced (and `master` for features of unreleased versions).

-->

Commits
-------

40df041 Documented how to add or remove values of multi-valued attributes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants