tripal_library.DEPRECATED.inc 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal library
  5. * api
  6. */
  7. /**
  8. * @deprecated Restructured API to make naming more readable and consistent.
  9. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  10. * now. This function has been replaced by chado_get_property().
  11. *
  12. * @see chado_get_property().
  13. */
  14. function tripal_library_get_property($library_id, $property) {
  15. tripal_report_error(
  16. 'tripal_deprecated',
  17. TRIPAL_NOTICE,
  18. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  19. [
  20. '%old_function' => 'tripal_library_get_property',
  21. '%new_function' => 'chado_get_property',
  22. ]
  23. );
  24. $record = [
  25. 'table' => 'library',
  26. 'id' => $library_id,
  27. ];
  28. $property = [
  29. 'type_name' => $property,
  30. 'cv_name' => 'library_property',
  31. ];
  32. return chado_get_property($record, $property);
  33. }
  34. /**
  35. * @deprecated Restructured API to make naming more readable and consistent.
  36. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  37. * now. This function has been replaced by chado_insert_property().
  38. *
  39. * @see chado_insert_property().
  40. */
  41. function tripal_library_insert_property($library_id, $property, $value, $update_if_present = 0) {
  42. tripal_report_error(
  43. 'tripal_deprecated',
  44. TRIPAL_NOTICE,
  45. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  46. [
  47. '%old_function' => 'tripal_library_insert_property',
  48. '%new_function' => 'chado_insert_property',
  49. ]
  50. );
  51. $record = [
  52. 'table' => 'library',
  53. 'id' => $library_id,
  54. ];
  55. $property = [
  56. 'type_name' => $property,
  57. 'cv_name' => 'library_property',
  58. 'value' => $value,
  59. ];
  60. $options = [
  61. 'update_if_present' => $update_if_present,
  62. ];
  63. return chado_insert_property($record, $property, $options);
  64. }
  65. /**
  66. * @deprecated Restructured API to make naming more readable and consistent.
  67. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  68. * now. This function has been replaced by chado_update_property().
  69. *
  70. * @see chado_update_property().
  71. */
  72. function tripal_library_update_property($library_id, $property, $value, $insert_if_missing = 0) {
  73. tripal_report_error(
  74. 'tripal_deprecated',
  75. TRIPAL_NOTICE,
  76. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  77. [
  78. '%old_function' => 'tripal_library_update_property',
  79. '%new_function' => 'chado_update_property',
  80. ]
  81. );
  82. $record = [
  83. 'table' => 'library',
  84. 'id' => $library_id,
  85. ];
  86. $property = [
  87. 'type_name' => $property,
  88. 'cv_name' => 'library_property',
  89. 'value' => $value,
  90. ];
  91. $options = [
  92. 'insert_if_missing' => $insert_if_missing,
  93. ];
  94. return chado_update_property($record, $property, $options);
  95. }
  96. /**
  97. * @deprecated Restructured API to make naming more readable and consistent.
  98. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  99. * now. This function has been replaced by chado_delete_property().
  100. *
  101. * @see chado_delete_property().
  102. */
  103. function tripal_library_delete_property($library_id, $property) {
  104. tripal_report_error(
  105. 'tripal_deprecated',
  106. TRIPAL_NOTICE,
  107. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  108. [
  109. '%old_function' => 'tripal_library_delete_property',
  110. '%new_function' => 'chado_delete_property',
  111. ]
  112. );
  113. $record = [
  114. 'table' => 'library',
  115. 'id' => $library_id,
  116. ];
  117. $property = [
  118. 'type_name' => $property,
  119. 'cv_name' => 'library_property',
  120. ];
  121. return chado_delete_property($record, $property);
  122. }