6

Actually I work in a project developed using drupal 7. Drupal is totally new for me and sometimes something happens that leaves me stunned… Today I have discovered something terrifying: when a content type is renamed (and his machine name change), you have to turn the whole project in the parts where the content type was used (in my specific case rules link) because when the machine name change it is possible that the references are lost!!!

You can help me to understand this comportament?

8
  • 6
    Yes, that would be the expected behaviour as far as I can tell. Drupal doesn't offer a full-scale referential-integrity check any time you do something through the UI or directly in the database (it would be basically impossible to enforce that, certainly with Drupal 7's architecture). The machine name of the node type is its table's primary key, so if you change that you'll need to update references to it manually for the most part. There's no foreign keys or cascading updates in Drupal tables unfortunately
    – Clive
    Mar 14 '13 at 12:07
  • tnx @Clive for your response. I think this is crazy
    – vincenzodb
    Mar 14 '13 at 13:27
  • Don't forget...Drupal is not a single, self-contained entity. It's extend by modules, which are not required to describe themselves or their data relationships to core functionality in any global manner. If such a descriptive element existed it would make Drupal a completely different system (not to mention the absolute I Ching of CMS's worldwide at the same time). I don't know of any CMS out there that's as tightly coupled as you'd need it to be, while still being useful and extensible for developers. It is definitely a pain, but it's one of those mistakes that you only make once :)
    – Clive
    Mar 14 '13 at 13:37
  • 1
    On a dev site, if you use Features to save configuration, you can go through the features files doing find / replace (carefully, of course) to ensure all related entries are updated. We did this on a project recently and had no problems. To do this on a live site would be a different matter, and my advice would be simply: don't. Change the label of the content type and leave the machine name alone. If people don't like it tell them the risks and potential costs. Mar 14 '13 at 13:43
  • 1
    @Clive yes, I have discovered one drupal's defect and will be very careful in the future :) Regards the other CMS, if I rename an item (ok is different, but the concept is the same) I don't lose its reference with other items.
    – vincenzodb
    Mar 14 '13 at 15:18
1

why not name it back, and then only changing the displayname, not the machinename would maybe sufficent for you ?

else do an export and import - as suggestes via features module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.