Problem/Motivation

At the moment you always have to specify the $values on entity_create but there is no real reason to require that,
though would be handy if there wouldn't be a requirement.

Proposed resolution

Make it optional.

Comments

dawehner’s picture

Status: Active » Needs review
StatusFileSize
new19.04 KB

Here we go.

chx’s picture

Status: Needs review » Reviewed & tested by the community

Love this. Simple and good: removes code, mostly. Ready pending on bot approval.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, drupal-1857442-1.patch, failed testing.

tim.plunkett’s picture

Status: Needs work » Needs review

#1: drupal-1857442-1.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, drupal-1857442-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new23.12 KB
new4.09 KB

Urgs, i could have known that.

Status: Needs review » Needs work

The last submitted patch, drupal-1857442-6.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
StatusFileSize
new24.42 KB

New patch which passes the installation now.

enhdless’s picture

Issue summary: View changes
Status: Needs review » Needs work

Been a while, patch needs rerolling.

tstoeckler’s picture

+++ b/core/includes/entity.inc
@@ -254,16 +254,16 @@ function entity_delete_multiple($entity_type, array $ids) {
+ *   (optional) An array of values to set, keyed by property name. If the entity type has
...
- *   An array of values to set, keyed by property name. If the entity type has

This should wrap after 80 characters (i.e. after "entity").

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new41.98 KB

Rerolled. Fixed comments as per #10, ensured that all *StorageController classes have a default $values = array(), ensured that all calls to entity_create() no longer pass an empty array() where one isn't needed.

snig’s picture

Status: Needs review » Needs work

The last submitted patch, 11: 1857442-entity_create-optional-values-11.patch, failed testing.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new41.87 KB

Rerolled.

snig’s picture

Status: Needs review » Reviewed & tested by the community

nice work.

grep -Rn "entity_create('.*', array())" * | wc -l
result : 0

RTBC

catch’s picture

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 14: 1857442-entity_create-optional-values-14.patch, failed testing.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new43.81 KB

Rerolled.

Status: Needs review » Needs work

The last submitted patch, 18: 1857442-entity_create-optional-values-18.patch, failed testing.

The last submitted patch, 18: 1857442-entity_create-optional-values-18.patch, failed testing.

longwave’s picture

Status: Needs work » Needs review
StatusFileSize
new44.45 KB

Missed FieldableEntityStorageControllerBase::create(), rerolled again.

longwave’s picture

StatusFileSize
new44.36 KB

No longer applied, rerolled.

berdir’s picture

Status: Needs review » Reviewed & tested by the community

Looks fine, will conflict again with https://drupal.org/node/1867228, but so be it ;)

webchick’s picture

Status: Reviewed & tested by the community » Fixed
Issue tags: +DX (Developer Experience)

Nice one! This makes the calling code significantly cleaner.

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.