Created
November 12, 2015 14:45
-
-
Save MatthieuScarset/4709ec3bee691c1c7707 to your computer and use it in GitHub Desktop.
Load all Drupal Commerce License
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$q = db_select('commerce_license', 'l'); | |
// $q->condition('l.type', your_type'); | |
// $q->condition('l.status', 2); // 2 = active | |
$q->fields('l', array('license_id') ); | |
$lids = $q->execute()->fetchCol(); | |
$ls = entity_load('commerce_license', $lids); | |
dpm($ls); | |
foreach($ls as $l){ | |
$info = $l->wrapper->getPropertyInfo(); | |
if( ! $info['edition_start']['type'] ) { | |
dpm( 'erreur with license ' ); | |
dpm($l); | |
} | |
else { | |
$edition = $l->wrapper->edition_start->value(); | |
if( empty($edition) ) { | |
// $l->edition_start['und'][0]['value'] = 1; | |
// entity_save('commerce_license', $l); | |
dpm($l); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment