tripal_contact.DEPRECATED.inc

  1. 2.x tripal_contact/api/tripal_contact.DEPRECATED.inc
  2. 3.x legacy/tripal_contact/api/tripal_contact.DEPRECATED.inc

Wrapper functions to provide backwards compatibility for the tripal contact api

File

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