1

I don't understand these functions of Magento 1:

  • getSelect()
  • join()
  • joinLeft()

Where can I find a complete doc with all functions documentation ?

Thanks..

  • is this question about magento 1? – Amit Bera Aug 2 at 10:43
2

The All Explanation i am Providing is On the Basis Of Magento2 the same will be in magento1 with some Syntax differences

You can use These Functions to Add Filters On your Database Collection

In your

Vendor\ModuleName\Model\ResourceModel\ModuleName\Collection

Like

getSelect()

/**
     * Get All Pages Have status Active
     * @return Collection
     */
    public function addFilterToStatus($status=1)
    {
        $this->getSelect()
            ->where('main_table.page_status = '.$status.' ');
        return $this;
    }

join()

   /**
     * Get Collection of Specfic Customer Groups
     * @param Integer
     * @return Collection
     */
    public function addFilterToCustomer($cusGroupId)
    {
        $this->getSelect()
            ->join(
                ['customer_groups' => $this->getTable('joined_table_name')], 'main_table.page_id = customer_groups.page_id', []
            )->where('customer_groups.customer_group_id = (?)', $cusGroupId);

        return $this;

    }

In the same way You can use Left Join as Well

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.