Announcement

Collapse
No announcement yet.

Just get where

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Just get where

    I want to get only the WHERE part of the SQL output. Because I will add "where" as to pure php.

    for example; WHERE assigned_status = 'Okay'
    like this

    Code:
    $sql = $this->getEntityManager()->getQuery()->createSelectQuery('Meeting', $selectParams);
    $sth = $pdo->prepare($sql);
    $sth->execute();
    Last edited by codeboy; 05-16-2018, 08:01 AM.

  • #2

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

    Comment


    • #3
      Yes, I see, I use it. But I do not want it to be "SELECT * FROM meeting". This function creates them. Because it wants an entity. I just need "WHERE".

      Comment


      • #4
        If you spend 2 minutes for reading the code, you will see, how is built each part of select query, wherePart as well.

        Comment


        • #5
          I could not. Would you show me a little sample, please?

          Comment


          • #6
            $whereClause = $params['whereClause'];
            if (empty($whereClause)) {
            $whereClause = array();
            }
            if (!$deleted) {
            $whereClause = $whereClause + array('deleted' => 0);
            }
            if (empty($params['joins'])) {
            $params['joins'] = array();
            }
            if (empty($params['leftJoins'])) {
            $params['leftJoins'] = array();
            }
            if (empty($params['customJoin'])) {
            $params['customJoin'] = '';
            }
            $wherePart = $this->getEntityManager()->getQuery()->getWhere($entity, $whereClause, 'AND', $params);
            $where = "WHERE " . $wherePart;


            copied from the the shared file....

            Comment


            • #7
              Very big thanks
              Argument 1 passed to Espo\\ORM\\DB\\Query\\Base::getWhere() must implement interface Espo\\ORM\\IEntity, string given, called

              because I use string
              Code:
              $this->getEntityManager()->getQuery()->getWhere('Meeting' ,$whereClause, 'AND', $params);
              What does this mean tanya ?

              Comment


              • #8
                means, the method waits for an object (of Meeting Entity)

                Comment


                • #9
                  Yeah, I check the codes you sent. I tried to do this. But it gives me a mistake. I'm on the custom report page.

                  Comment


                  • #10
                    Thanks, I solved tanya.
                    Last edited by codeboy; 05-16-2018, 11:09 AM.

                    Comment

                    Working...
                    X