src/ORM/DataQuery.php
protected function initialiseQuery()
    {
        // Join on base table and let lazy loading join subtables
        $baseClass = DataObject::getSchema()->baseDataClass($this->dataClass());
        if (!$baseClass) {
            throw new InvalidArgumentException("DataQuery::create() Can't find data classes for '{$this->dataClass}'");
        }

        // Build our intial query
        $this->query = new SQLSelect(array());
        $this->query->setDistinct(true);

        if ($sort = singleton($this->dataClass)->config()->get('default_sort')) {
            $this->sort($sort);
        }

        $baseTable = DataObject::getSchema()->tableName($baseClass);
        $this->query->setFrom("\"{$baseTable}\"");

        $obj = Injector::inst()->get($baseClass);
        $obj->extend('augmentDataQueryCreation', $this->query, $this);
    }
protected function initialiseQuery()
    {
        // Join on base table and let lazy loading join subtables
        $baseClass = DataObject::getSchema()->baseDataClass($this->dataClass());
        if (!$baseClass) {
            throw new InvalidArgumentException("DataQuery::create() Can't find data classes for '{$this->dataClass}'");
        }

        // Build our intial query
        $this->query = new SQLSelect(array());
        $this->query->setDistinct(true);

        if ($sort = singleton($this->dataClass)->config()->get('default_sort')) {
            $this->sort($sort);
        }

        $baseTable = DataObject::getSchema()->tableName($baseClass);
        $this->query->setFrom("\"{$baseTable}\"");

        $obj = Injector::inst()->get($baseClass);
        $obj->extend('augmentDataQueryCreation', $this->query, $this);
    }
protected function initialiseQuery ( ) { // Join on base table and let lazy loading join subtables $ baseClass = DataObject :: getSchema ( ) -> baseDataClass ( $ this -> dataClass ( ) ) ; if ( ! $ baseClass ) { throw new InvalidArgumentException ( "DataQuery::create() Can't find data classes for '{$this->dataClass}'" ) ; } // Build our intial query $ this -> query = new SQLSelect ( array ( ) ) ; $ this -> query -> setDistinct ( true ) ; if ( $ sort = singleton ( $ this -> dataClass ) -> config ( ) -> get ( 'default_sort' ) ) { $ this -> sort ( $ sort ) ; } $ baseTable = DataObject :: getSchema ( ) -> tableName ( $ baseClass ) ; $ this -> query -> setFrom ( "\"{$baseTable}\"" ) ; $ obj = Injector :: inst ( ) -> get ( $ baseClass ) ; $ obj -> extend ( 'augmentDataQueryCreation' , $ this -> query , $ this ) ; }
Set up the simplest initial query
Set up the simplest initial query