With the last dev version of UUID and Deploy I created a Feature to sync content between dev environments but when reverting contents in the empty environment it does't work due a constraint violation error that is related to the imagefields that some of the exported entities have:

Notice: Trying to get property of non-object in file_field_presave() (line 220 of /Users/pablocc/Sites/bluesparklabs/flamenco/www/modules/file/file.field.inc).
Notice: Undefined property: stdClass::$uri in file_save() (line 573 of /Users/pablocc/Sites/bluesparklabs/flamenco/www/includes/file.inc).
Notice: Undefined property: stdClass::$uri in file_entity_file_presave() (line 180 of /Users/pablocc/Sites/bluesparklabs/flamenco/www/sites/all/modules/contrib/file_entity/file_entity.module).
PDOException: SQLSTATE[01000]: Warning: 1265 Data truncated for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module, type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array ( [:db_insert_placeholder_0] => 3a4789bc-5eca-7c04-296e-be03c4b4c6e3 [:db_insert_placeholder_1] => file [:db_insert_placeholder_2] => node [:db_insert_placeholder_3] => 21 [:db_insert_placeholder_4] => 1 ) in file_usage_add() (line 663 of /Users/pablocc/Sites/bluesparklabs/flamenco/www/includes/file.inc).

I was debugging a little and the problem seems to happen when the image doesn't exist in the file system directory, but not sure 100%. I can't dedicate so much time on this and removing the imagefields in the created feature resolve the problem and import correctly the entities.

I removed the lines as:

'field_large_image' => array(
'und' => array(
0 => array(
'alt' => NULL,
'fid' => '47f49554-fc48-0464-853a-8f2c7bb72eea',
'filemime' => 'image/jpeg',
'filename' => 'blog_1438.jpg',
'filesize' => '478782',
'rdf_mapping' => array(),
'status' => '1',
'timestamp' => '1325209126',
'title' => NULL,
'type' => 'image',
'uid' => '1',
'uri' => 'public://blog_1438.jpg',
'uuid' => '47f49554-fc48-0464-853a-8f2c7bb72eea',
),
),

Then it works. I will create a patch to ignore the imagefields for the Deployed content that get stored in the feature but I think the correct patch will be to verify if the file exists when "Reverting" the feature UUID entitites and in case the file doesn't exist then no continue processing the image importation. Other important thing for make the images sync more easy is follow the approach of Node_export module that store the Image encoded in base64 in the code of the Feature.

Warm regards,

Pablo Cerda.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Paul Kim Consulting’s picture

I am getting this same issue with deploy. It appears UUID is trying to insert the uuid as the fid.

Paul Kim Consulting’s picture

Status: Active » Closed (won't fix)

Please see this issue fixed here: http://drupal.org/node/1324970

kenorb’s picture

Status: Closed (won't fix) » Active

Related:
#1324970: Image fields don't work Patch at #24
#1694972: File entity values fail on deployment

But still it doesn't solve the problem.

Error:

WD php: PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'b39bc45f-ff1a-4240-8b97-ca50c01debd0' for column 'fid' at row 1: INSERT INTO {file_usage} (fid, module,   [error]
type, id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4); Array
(
    [:db_insert_placeholder_0] => b39bc45f-ff1a-4240-8b97-ca50c01debd0
    [:db_insert_placeholder_1] => file
    [:db_insert_placeholder_2] => taxonomy_term
    [:db_insert_placeholder_3] => 4
    [:db_insert_placeholder_4] => 1
)
 in file_usage_add() (line 661 of trunk/includes/file.inc).

Field:

    'field_fx_image' => array(
      'und' => array(
        0 => array(
          'fid' => 'b39bc45f-ff1a-4240-8b97-ca50c01debd0',
          'alt' => '',
          'title' => '',
          'width' => '470',
          'height' => '300',
          'uid' => '1',
          'filename' => 'admiw.png',
          'uri' => 'public://images/admiw.png',
          'filemime' => 'image/png',
          'filesize' => '11135',
          'status' => '1',
          'timestamp' => '1351276862',
          'uuid' => 'b39bc45f-ff1a-4240-8b97-ca50c01debd0',
          'rdf_mapping' => array(),
          'filehash' => array(
            'md5' => '62ebf12edc9b9cd172f64ffe319ad495',
          ),
        ),
kenorb’s picture

It happens when I'm enabling featured module which has filefield (image) exported as uuid_term
Backtrace:

array (size=24)
  0 => 
    array (size=4)
      'file' => string 'modules/file/file.field.inc' (length=59)
      'line' => int 282
      'function' => string 'file_usage_add' (length=14)
      'args' => 
        array (size=4)
          ...
  1 => 
    array (size=4)
      'file' => string 'modules/image/image.field.inc' (length=61)
      'line' => int 257
      'function' => string 'file_field_update' (length=17)
      'args' => 
        array (size=6)
          ...
  2 => 
    array (size=4)
      'file' => string 'modules/field/field.attach.inc' (length=62)
      'line' => int 209
      'function' => string 'image_field_update' (length=18)
      'args' => 
        array (size=8)
          ...
  3 => 
    array (size=4)
      'file' => string 'modules/field/field.attach.inc' (length=62)
      'line' => int 958
      'function' => string '_field_invoke' (length=13)
      'args' => 
        array (size=3)
          ...
  4 => 
    array (size=4)
      'file' => string 'modules/taxonomy/taxonomy.module' (length=64)
      'line' => int 642
      'function' => string 'field_attach_update' (length=19)
      'args' => 
        array (size=2)
          ...
  5 => 
    array (size=4)
      'file' => string 'modules/contrib/entity/entity.module' (length=78)
      'line' => int 181
      'function' => string 'taxonomy_term_save' (length=18)
      'args' => 
        array (size=1)
          ...
  6 => 
    array (size=4)
      'file' => string 'modules/contrib/uuid/uuid.entity.inc' (length=78)
      'line' => int 215
      'function' => string 'entity_save' (length=11)
      'args' => 
        array (size=2)
          ...
  7 => 
    array (size=4)
      'file' => string 'modules/contrib/uuid_features/includes/uuid_term.features.inc' (length=103)
      'line' => int 148
      'function' => string 'entity_uuid_save' (length=16)
      'args' => 
        array (size=2)
          ...
  8 => 
    array (size=2)
      'function' => string 'uuid_term_features_rebuild' (length=26)
      'args' => 
        array (size=2)
          ...
  9 => 
    array (size=4)
      'file' => string 'modules/contrib/features/features.module' (length=82)
      'line' => int 516
      'function' => string 'call_user_func_array' (length=20)
      'args' => 
        array (size=2)
          ...
  10 => 
    array (size=4)
      'file' => string 'modules/contrib/features/features.module' (length=82)
      'line' => int 871
      'function' => string 'features_invoke' (length=15)
      'args' => 
        array (size=3)
          ...
  11 => 
    array (size=4)
      'file' => string 'modules/contrib/features/features.module' (length=82)
      'line' => int 893
      'function' => string '_features_restore' (length=17)
      'args' => 
        array (size=2)
          ...
  12 => 
    array (size=4)
      'file' => string 'modules/contrib/features/features.module' (length=82)
      'line' => int 229
      'function' => string 'features_rebuild' (length=16)
      'args' => 
        array (size=0)
          ...
  13 => 
    array (size=2)
      'function' => string 'features_flush_caches' (length=21)
marcvangend’s picture

I'm having the same problem, but with field collections instead of images. As said in #1, it appears UUID is trying to insert the uuid as the field collection id.

marcvangend’s picture

picardmyhero’s picture

I'm having a similar problem when I deploy a content type that has a field_collection.
The destination server shows this error:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: 'ea45cc51-b7ca-45e4-a8d4-6e1d4adbcee5' for column 'field_image_gallery_value' at row 1: INSERT INTO {field_data_field_image_gallery} (entity_type, entity_id, revision_id, bundle, delta, language, field_image_gallery_value) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1,
etc.

Does anyone know of a fix for this problem?

Thanks,
Tim

succinct’s picture

I'm having this issue as well. I'm trying to upload a node with an image field, and it fails even with the most recent versions of Services, UUID and Deploy. This is a total dealbreaker if we can't move our files between environments..

milesw’s picture

Title: UUID Features crash when the aggregated content in a feature has a imagefield » UUID Features crash with fields that reference other objects

This appears to be a more general problem that's related to any field that references another object. That includes reference fields (node, taxonomy, user), file fields, and image fields. The problem manifests when you try to save an entity/object that includes a field pointing to something that doesn't exist - common when deploying using UUID Features.

For example...

Let's say you have a taxonomy term captured using UUID Features, and that taxonomy term has an image field. The image field references a specific file object, and in the exported code there is a UUID for the image file.

When UUID Features goes to save the taxonomy term on another installation (not the one where it was captured) it tries to resolve the UUID for the image file into a file FID. However, this installation might not have the image file. What happens in that case is the UUID gets left there as the file ID, and Drupal tries to insert the UUID into the database as the FID.

Seems like this would be a UUID Features issue, but the cause is really entity_property_uuid_to_id() in the UUID module. When a UUID can't be converted, the item needs be removed.

milesw’s picture

Status: Active » Needs review
FileSize
1.46 KB

Here is a patch that resolves the issue for me. If a UUID lookup for a property/field value fails, that value gets ignored instead of saved as-is.

mpgeek’s picture

This patch worked for me with a Deploy scenario using field_collections. The logic for removing the failed lookup fixed the sql insert problem noted in #1820606: Deploy field collection failed on sql insert, and I would guess that this fixes many failed-lookup issues where entity properties do not get converted back to an id from a uuid on a presave/insert. Nice work @milesw.

Status: Needs review » Needs work

The last submitted patch, 10: 1390708-10-uuid-field-insert.patch, failed testing.

jamsilver’s picture

Attaching a slight variation on the above patch. I don't think we should unset the property when it's not a valid UUID. This solved a problem I was having where a file entity had been exported with a literal 'uid' => 1, rather than a UUID-ed version. In this case, I think it's desirable to try and import the file by user 1, rather than unset it.

junedkazi’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 13: uuid-1390708-13-uuid-field-insert.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 13: uuid-1390708-13-uuid-field-insert.patch, failed testing.

Darren Oh’s picture

Title: UUID Features crash with fields that reference other objects » Fix crash with reference to missing entity
Status: Needs work » Needs review
FileSize
1.47 KB
812 bytes

The previous patches were not converting all UUIDs to local IDs.