-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…h-joining' Close #1353
- Loading branch information
Showing
10 changed files
with
694 additions
and
115 deletions.
There are no files selected for viewing
376 changes: 278 additions & 98 deletions
376
lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
lib/Doctrine/ORM/Tools/Pagination/RowNumberOverFunction.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?php | ||
|
||
/* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | ||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | ||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | ||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | ||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | ||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
* | ||
* This software consists of voluntary contributions made by many individuals | ||
* and is licensed under the MIT license. For more information, see | ||
* <http://www.doctrine-project.org>. | ||
*/ | ||
|
||
namespace Doctrine\ORM\Tools\Pagination; | ||
|
||
use Doctrine\ORM\ORMException; | ||
use Doctrine\ORM\Query\AST\Functions\FunctionNode; | ||
|
||
|
||
/** | ||
* RowNumberOverFunction | ||
* | ||
* Provides ROW_NUMBER() OVER(ORDER BY...) construct for use in LimitSubqueryOutputWalker | ||
* | ||
* @since 2.5 | ||
* @author Bill Schaller <[email protected]> | ||
*/ | ||
class RowNumberOverFunction extends FunctionNode | ||
{ | ||
/** | ||
* @var \Doctrine\ORM\Query\AST\OrderByClause | ||
*/ | ||
public $orderByClause; | ||
|
||
/** | ||
* @override | ||
*/ | ||
public function getSql(\Doctrine\ORM\Query\SqlWalker $sqlWalker) | ||
{ | ||
return 'ROW_NUMBER() OVER(' . trim($sqlWalker->walkOrderByClause( | ||
$this->orderByClause | ||
)) . ')'; | ||
} | ||
|
||
/** | ||
* @override | ||
* | ||
* @throws ORMException | ||
*/ | ||
public function parse(\Doctrine\ORM\Query\Parser $parser) | ||
{ | ||
throw new ORMException("The RowNumberOverFunction is not intended for, nor is it enabled for use in DQL."); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?php | ||
namespace Doctrine\Tests\Models\Pagination; | ||
|
||
/** | ||
* Department | ||
* | ||
* @package Doctrine\Tests\Models\Pagination | ||
* | ||
* @author Bill Schaller | ||
* @Entity | ||
* @Table(name="pagination_department") | ||
*/ | ||
class Department | ||
{ | ||
/** | ||
* @Id @Column(type="integer") | ||
* @GeneratedValue | ||
*/ | ||
public $id; | ||
|
||
/** | ||
* @Column(type="string") | ||
*/ | ||
public $name; | ||
|
||
/** | ||
* @ManyToOne(targetEntity="Company", inversedBy="departments", cascade={"persist"}) | ||
*/ | ||
public $company; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Models\Pagination; | ||
|
||
|
||
/** | ||
* @package Doctrine\Tests\Models\Pagination | ||
* | ||
* @Entity | ||
* @Table(name="pagination_user") | ||
* @InheritanceType("SINGLE_TABLE") | ||
* @DiscriminatorColumn(name="type", type="string") | ||
* @DiscriminatorMap({"user1"="User1"}) | ||
*/ | ||
abstract class User | ||
{ | ||
/** | ||
* @Id @Column(type="integer") | ||
* @GeneratedValue | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @Column(type="string") | ||
*/ | ||
public $name; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<?php | ||
|
||
namespace Doctrine\Tests\Models\Pagination; | ||
|
||
/** | ||
* Class User1 | ||
* @package Doctrine\Tests\Models\Pagination | ||
* | ||
* @Entity() | ||
*/ | ||
class User1 extends User | ||
{ | ||
/** | ||
* @Column(type="string") | ||
*/ | ||
public $email; | ||
} |
Oops, something went wrong.