/**
  * Method to delete a PostTypeLink
  *
  * @access public
  *
  * @param int $id
  *
  * @return boolean
  */
 public function delete($id)
 {
     /**
      * Action: 'pc_before_connection_delete' - Action that is ran before the connection is deleted
      *
      * @api int $id The Connection id
      */
     do_action('pc_before_connection_delete', $id);
     // Backwards compatibility
     do_action('sp_before_post_type_link_delete', $id);
     // Can't remove this because of BC
     // Delete all links
     $post_link_manager = new SP_Post_Link_Manager();
     $links = $post_link_manager->get_all_links($id);
     if (count($links) > 0) {
         foreach ($links as $link) {
             wp_delete_post($link->ID, true);
         }
     }
     // Delete the connection
     wp_delete_post($id, true);
     /**
      * Action: 'pc_after_connection_delete' - Action that is ran after the connection is deleted
      *
      * @api int $id The Connection id
      */
     do_action('pc_after_connection_delete', $id);
     // Backwards compatibility
     do_action('sp_after_post_type_link_delete', $id);
     // Can't remove this because of BC
     return true;
 }