I'm not access the team_user table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • codeboy
    Senior Member
    • May 2018
    • 112

    I'm not access the team_user table

    I create custom reports and filter for teams. There are two new fields in the "team_user" table. Start and end dates. These two new areas need to be conditioned for where. But I can not find entitiy for "team_user".

    I can break the "$where" variable for the activity table but I can't do this for the "team_user" table.

    For example;

    Code:
    $params = array();
    $result['whereClause'][] = $this->convertDateTimeWhere(array(
        'type' => $type,
        'value' => $value,
        'attribute' => 'dateStart',
        'timeZone' => $timeZone
    ));
    
    if (empty($result)) {
        $result = array();
    }
    
    $entity    = $this->getEntityManager()->getEntity('Meeting');
    $wherePart = $this->getEntityManager()->getQuery()->getWhere($entity ,$result['whereClause'], 'AND', $params);
    
    return $wherePart;
    $entity = $this->getEntityManager()->getEntity('TeamUser'); not working. I need this.

    I added the sample image file.
    Attached Files
  • tanya
    Senior Member
    • Jun 2014
    • 4308

    #2

    Comment

    • codeboy
      Senior Member
      • May 2018
      • 112

      #3
      How to use tanya?

      $entity = $this->getEntityManager()->getRepository('Team')->findRelated($teamId,'teamuser');

      Don't work

      Comment

      • tanya
        Senior Member
        • Jun 2014
        • 4308

        #4
        the last parameter is the name of the link
        this name https://github.com/espocrm/espocrm/b.../Team.json#L27
        And this method returns not one entity, but the list of entities

        Comment

        • codeboy
          Senior Member
          • May 2018
          • 112

          #5
          Originally posted by tanya
          the last parameter is the name of the link
          this name https://github.com/espocrm/espocrm/b.../Team.json#L27
          And this method returns not one entity, but the list of entities
          Hello again,
          I do not want to relationship the user. I have new features in the team_user table. (Start and end date). I need to specify "where" in these two columns.

          For example;

          Code:
          $userIdList = [];
          $targetTeamId = '5adc54b31d11c1a1a';        
          $team = $this->getEntityManager()->getEntity('Team', $targetTeamId);
          
          $targetUserList = $this->getEntityManager()->getRepository('Team')->findRelated($team, 'users', array(
              'whereClause' => $this->convertDateTimeWhere(array(
                  'type' => $type,
                  'value' => $value,
                  'attribute' => 'startDate',
                  'timeZone' => $timeZone
              ))
          ));
          
          foreach ($targetUserList as $user) {
              $userIdList[] = $user->id;
          }
          
          return $userIdList;
          Only "users" in this way works. I want to access the team_user table startDate attibutes for where. Do you understand me ? I want access "team_user" table.
          Please help me.

          Comment

          • tanya
            Senior Member
            • Jun 2014
            • 4308

            #6
            EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.

            Comment

            Working...