tripal_contact.DEPRECATED.inc 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <?php
  2. /**
  3. * @file
  4. * Wrapper functions to provide backwards compatibility for the tripal contact
  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_contact_get_property($contact_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_contact_get_property',
  21. '%new_function' => 'chado_get_property',
  22. ]
  23. );
  24. $record = [
  25. 'table' => 'contact',
  26. 'id' => $contact_id,
  27. ];
  28. $property = [
  29. 'type_name' => $property,
  30. 'cv_name' => 'contact_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_contact_insert_property($contact_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_contact_insert_property',
  48. '%new_function' => 'chado_insert_property',
  49. ]
  50. );
  51. $record = [
  52. 'table' => 'contact',
  53. 'id' => $contact_id,
  54. ];
  55. $property = [
  56. 'type_name' => $property,
  57. 'cv_name' => 'contact_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_contact_update_property($contact_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_contact_update_property',
  79. '%new_function' => 'chado_update_property',
  80. ]
  81. );
  82. $record = [
  83. 'table' => 'contact',
  84. 'id' => $contact_id,
  85. ];
  86. $property = [
  87. 'type_name' => $property,
  88. 'cv_name' => 'contact_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_contact_delete_property($contact_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_contact_delete_property',
  110. '%new_function' => 'chado_delete_property',
  111. ]
  112. );
  113. $record = [
  114. 'table' => 'contact',
  115. 'id' => $contact_id,
  116. ];
  117. $property = [
  118. 'type_name' => $property,
  119. 'cv_name' => 'contact_property',
  120. ];
  121. return chado_delete_property($record, $property);
  122. }
  123. /**
  124. * @deprecated Restructured API to make naming more readable and consistent.
  125. * Function was deprecated in Tripal 2.0 and will be removed 2 releases from
  126. * now. This function has been replaced by tripal_insert_contact().
  127. *
  128. * @see tripal_insert_contact().
  129. */
  130. function tripal_contact_add_contact($name, $description, $type, $properties) {
  131. tripal_report_error(
  132. 'tripal_deprecated',
  133. TRIPAL_NOTICE,
  134. "DEPRECATED: %old_function has been replaced with %new_function. Please update your code.",
  135. [
  136. '%old_function' => 'tripal_contact_add_contact',
  137. '%new_function' => 'tripal_insert_contact',
  138. ]
  139. );
  140. return tripal_insert_contact([
  141. 'name' => $name,
  142. 'description' => $description,
  143. 'type_name' => $type,
  144. 'properties' => $properties,
  145. ]);
  146. }