Answers.Body: <p>You can use CRM_Contribute_BAO_Contribution::getContributionTokenValues() function to get details of contribution based on contribution id.</p>
  <p>To get all data of contribution you can use api</p>
  <pre><code>$contributionData = civicrm_api3('Contribution', 'getsingle', ['id' =&gt; $contributionId]);
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-15T14:52:44.613Z
Answers.Text: Thank you for your answer.for the getContributionTokenValues() function i want to pass the contribution id and the parameter na? but i want to retrieve all the values based on only the contribution ID.is there any particular function to get it?
Answers.UserDisplayName: safron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-15T15:02:05.840Z
Answers.Text: yes you need to pass contribution id and other params. To get the values based on contribution id you can use api(updated my answer with api call)
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T09:39:03.717Z
Answers.Text: Thank you for your answer.. do you mind if i ask another question? is there any in-build API like you stated above to retrieve data from a view?
Answers.UserDisplayName: safron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T11:43:20.273Z
Answers.Text: shoot please....
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T11:55:04.937Z
Answers.Text: Thanks..the question is i want retrieve data from a view. Is there any inbuilt API available for it ? I feel running a SQL then taken the result, fetching it and assigning into another array is less efficient. so I'm finding an alternative way
Answers.UserDisplayName: safron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T11:59:09.507Z
Answers.Text: Which view are you talking about?
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T11:59:55.727Z
Answers.Text: i mean SQL view
Answers.UserDisplayName: safron
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-23T12:04:05.897Z
Answers.Text: I am sorry, i dont think i am following you, can mail your question to me(you can find my email id under my profile) .
  Also can you mark this as answered if solved your problem?
Answers.UserDisplayName: Pradeep Nayak
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-07-15T13:31:18.850Z
Answers.LastActivityDate: 2020-07-15T15:01:30.803Z
Answers.LastEditDate: 2020-07-15T15:01:30.803Z
Answers.UserDisplayName: Pradeep Nayak
Body: <p>I want to get all the contribution table entries as a list which are equivalent to a given ID.</p>
  <p>My contribution table has 4 entries and the contact ID for all the four contribution is 2.</p>
  <p>I'm using the below method to get the details, but which takes the given ID as contactID and return the entries when contactID = contributionID..</p>
  <pre><code>foreach ($values as $key =&gt; $value){
          
          $contributionID = $values[$key]; //contribution IDs are 1,2,3,4,5
          
          // get the details for all selected contacts
          list($contributionDetails) = CRM_Utils_Token::getTokenDetails(array($contributionID),
            $this-&gt;_returnProperties,
            NULL, NULL, FALSE,
            $this-&gt;_allTokens
          );
  </code></pre>
  <p>Mean this only returns a row where contribution ID = contact ID = 2..but i want to get all the raw where contribution id is equal to 1,2,3,4 and 5.. how should i get it?</p>
  <p>Thanks in advance!</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-15T10:09:58.883Z
Comments.Text: I'm not understanding what you want to do.  What's the bigger picture?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-07-15T12:48:26.950Z
Comments.Text: @Aidan I'm searchiing a method to input contribution ID and return all the token details..is there any particular class and a method to perform it?
Comments.UserDisplayName: safron
Tags: <civicontribute>
Title: How do i get the contribution table entries?
ThreadText: # How do i get the contribution table entries?
  
  (Asked by: username_0 on 2020-07-15)
  
  I want to get all the contribution table entries as a list which are equivalent to a given ID.
  My contribution table has 4 entries and the contact ID for all the four contribution is 2.
  I'm using the below method to get the details, but which takes the given ID as contactID and return the entries when contactID = contributionID..
  foreach ($values as $key => $value){
          
          $contributionID = $values[$key]; //contribution IDs are 1,2,3,4,5
          
          // get the details for all selected contacts
          list($contributionDetails) = CRM_Utils_Token::getTokenDetails(array($contributionID),
            $this->_returnProperties,
            NULL, NULL, FALSE,
            $this->_allTokens
          );
  
  Mean this only returns a row where contribution ID = contact ID = 2..but i want to get all the raw where contribution id is equal to 1,2,3,4 and 5.. how should i get it?
  Thanks in advance!
  
  **Tags:** civicontribute
  
  > **Comments:**
  > **username_1**: I'm not understanding what you want to do.  What's the bigger picture?  
  > **username_0**: @username_1 I'm searchiing a method to input contribution ID and return all the token details..is there any particular class and a method to perform it?  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2020-07-15. Score: 3 | Accepted answer
  
  You can use CRM_Contribute_BAO_Contribution::getContributionTokenValues() function to get details of contribution based on contribution id.
  To get all data of contribution you can use api
  $contributionData = civicrm_api3('Contribution', 'getsingle', ['id' => $contributionId]);
  
  > **Comments:**
  > **username_0**: Thank you for your answer.for the getContributionTokenValues() function i want to pass the contribution id and the parameter na? but i want to retrieve all the values based on only the contribution ID.is there any particular function to get it?  
  > **username_2**: yes you need to pass contribution id and other params. To get the values based on contribution id you can use api(updated my answer with api call)  
  > **username_0**: Thank you for your answer.. do you mind if i ask another question? is there any in-build API like you stated above to retrieve data from a view?  
  > **username_2**: shoot please....  
  > **username_0**: Thanks..the question is i want retrieve data from a view. Is there any inbuilt API available for it ? I feel running a SQL then taken the result, fetching it and assigning into another array is less efficient. so I'm finding an alternative way  
  > **username_2**: Which view are you talking about?  
  > **username_0**: i mean SQL view  
  > **username_2**: I am sorry, i dont think i am following you, can mail your question to me(you can find my email id under my profile) . Also can you mark this as answered if solved your problem?  
  
  ---
  
  