# Possible Bug on LeadRepository

**URL:** <https://forum.mautic.org/t/possible-bug-on-leadrepository/8559>\
**Category:** Product Support\
**Created:** [May 23, 2017, 8:10am UTC](https://forum.mautic.org/t/possible-bug-on-leadrepository/8559 "2017-05-23T08:10:41Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![tures](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@tures](https://forum.mautic.org/u/tures)\
**Post date:** [May 23, 2017, 8:10am UTC](https://forum.mautic.org/t/possible-bug-on-leadrepository/8559/1 "2017-05-23T08:10:41Z")

</div>

Hi everyone. I have a problem with the companies while running the campaign trigger. I have setted a segment with some contacts and their companies. When campaign trigger start, it give an error on getEntities function in LeadRepository, when attempts to make the following call: $tmpContacts[$id]-\>setPrimaryCompany($primary);  
  
  
  
I saw that setPrimaryCompany function, in situated on LeadModel, but instead the call is performed by a lead object. So this call generate the following error: [InvalidArgumentException]  
  
Method setPrimaryCompany not exists  
  
  
  
Moreover, when this call attempt, is passed only on parameter, while the function definition is the following:  
  
public function setPrimaryCompany($companyId, $leadId);  
  
  
  
It is a possible bug?  
  
  
  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![tures](https://avatars.discourse-cdn.com/v4/letter/t/ba9def/32.png) [@tures](https://forum.mautic.org/u/tures)\
**Post date:** [May 23, 2017, 8:10am UTC](https://forum.mautic.org/t/possible-bug-on-leadrepository/8559/2 "2017-05-23T08:10:41Z")

</div>

Hi everyone. I have a problem with the companies while running the campaign trigger. I have setted a segment with some contacts and their companies. When campaign trigger start, it give an error on getEntities function in LeadRepository, when attempts to make the following call: $tmpContacts[$id]-\>setPrimaryCompany($primary);

I saw that setPrimaryCompany function, in situated on LeadModel, but instead the call is performed by a lead object. So this call generate the following error: [InvalidArgumentException]  
Method setPrimaryCompany not exists

Moreover, when this call attempt, is passed only on parameter, while the function definition is the following:  
public function setPrimaryCompany($companyId, $leadId);

It is a possible bug?

Thanks in advance.
