Skip to content

Commit 7e6871d

Browse files
committed
fmt
1 parent 6fc5680 commit 7e6871d

File tree

9 files changed

+54
-66
lines changed

9 files changed

+54
-66
lines changed

LeanMapperQuery/Entity.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
use LeanMapper\Reflection\Property;
1515
use LeanMapper\Relationship;
1616
use LeanMapperQuery\Caller;
17-
use LeanMapperQuery\IQuery;
1817
use LeanMapperQuery\Exception\InvalidArgumentException;
1918
use LeanMapperQuery\Exception\InvalidMethodCallException;
2019
use LeanMapperQuery\Exception\InvalidRelationshipException;
2120
use LeanMapperQuery\Exception\InvalidStateException;
2221
use LeanMapperQuery\Exception\MemberAccessException;
22+
use LeanMapperQuery\IQuery;
2323

2424
/**
2525
* @author Michal Bohuslávek
@@ -29,7 +29,6 @@ class Entity extends LeanMapper\Entity
2929
/** @var array */
3030
protected static $magicMethodsPrefixes = array();
3131

32-
3332
protected function queryProperty($field, IQuery $query)
3433
{
3534
if ($this->isDetached()) {

LeanMapperQuery/Query.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010

1111
use LeanMapper;
1212
use LeanMapper\Fluent;
13-
use LeanMapper\ImplicitFilters;
1413
use LeanMapper\IMapper;
14+
use LeanMapper\ImplicitFilters;
1515
use LeanMapper\Reflection\Property;
1616
use LeanMapper\Relationship;
1717
use LeanMapperQuery\Exception\InvalidArgumentException;
@@ -74,7 +74,6 @@ class Query implements IQuery
7474
*/
7575
protected $replacePlaceholders = FALSE;
7676

77-
7877
/** @var array */
7978
private $queue = array();
8079

@@ -87,7 +86,6 @@ class Query implements IQuery
8786
/** @var array */
8887
private $joinAlternative = array();
8988

90-
9189
private function getPropertiesByTable($tableName)
9290
{
9391
$entityClass = $this->mapper->getEntityClass($tableName);
@@ -331,8 +329,7 @@ protected function parseStatement($statement, $replacePlaceholders = NULL)
331329
list($entityClass, $properties) = $this->traverseToRelatedEntity($tableName, $tableNameAlias, $property);
332330
$propertyName = '';
333331
} else {
334-
if ($property->hasRelationship())
335-
{
332+
if ($property->hasRelationship()) {
336333
// If the last property also has relationship replace with primary key field value.
337334
// NOTE: Traversing to a related entity is necessary even for the HasOne and HasMany
338335
// relationships if there are implicit filters to be applied.
@@ -404,7 +401,7 @@ protected function getFluent()
404401

405402
/**
406403
* @inheritdoc
407-
* @throws InvalidArgumentException
404+
* @throws InvalidArgumentException
408405
*/
409406
public function applyQuery(Fluent $fluent, IMapper $mapper)
410407
{

tests/LeanMapperQuery/Entity.joins.phpt

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,33 +37,33 @@ class AuthorRepository extends BaseRepository
3737
}
3838

3939
/**
40-
* @property int $id
40+
* @property int $id
4141
* @property string $name
4242
*/
4343
class Tag extends BaseEntity
4444
{
4545
}
4646

4747
/**
48-
* @property int $id
49-
* @property Author $author m:hasOne
50-
* @property Author|NULL $reviewer m:hasOne(reviewer_id)
51-
* @property Tag[] $tags m:hasMany
52-
* @property string $pubdate
53-
* @property string $name
48+
* @property int $id
49+
* @property Author $author m:hasOne
50+
* @property Author|NULL $reviewer m:hasOne(reviewer_id)
51+
* @property Tag[] $tags m:hasMany
52+
* @property string $pubdate
53+
* @property string $name
5454
* @property string|NULL $description
5555
* @property string|NULL $website
56-
* @property bool $available
56+
* @property bool $available
5757
*/
5858
class Book extends BaseEntity
5959
{
6060
}
6161

6262
/**
63-
* @property int $id
64-
* @property string $name
65-
* @property Book[] $books m:belongsToMany
66-
* @property Book[] $reviewedBooks m:belongsToMany(reviewer_id)
63+
* @property int $id
64+
* @property string $name
65+
* @property Book[] $books m:belongsToMany
66+
* @property Book[] $reviewedBooks m:belongsToMany(reviewer_id)
6767
* @property string|NULL $web
6868
*/
6969
class Author extends BaseEntity
@@ -88,7 +88,6 @@ $bookTags = $book->find('tags', getQuery()
8888

8989
Assert::same(1, count($bookTags));
9090

91-
9291
$authorRepository = new AuthorRepository($connection, $mapper, $entityFactory);
9392
$authors = $authorRepository->findAll();
9493
$author = $authors[1];
@@ -99,7 +98,6 @@ $authorBooks = $author->find('books', getQuery()
9998

10099
Assert::same(0, count($authorBooks));
101100

102-
103101
// exceptions
104102
$book = $books[2];
105103

tests/LeanMapperQuery/Query.filters.phpt

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,24 +28,24 @@ class FilterMapper extends TestMapper
2828
}
2929

3030
/**
31-
* @property int $id
32-
* @property Author $author m:hasOne
33-
* @property Author|NULL $reviewer m:hasOne(reviewer_id)
34-
* @property string $pubdate
35-
* @property string $name
31+
* @property int $id
32+
* @property Author $author m:hasOne
33+
* @property Author|NULL $reviewer m:hasOne(reviewer_id)
34+
* @property string $pubdate
35+
* @property string $name
3636
* @property string|NULL $description
3737
* @property string|NULL $website
38-
* @property bool $available
38+
* @property bool $available
3939
*/
4040
class Book extends Entity
4141
{
4242
}
4343

4444
/**
45-
* @property int $id
46-
* @property string $name
47-
* @property Book[] $books m:belongsToMany
48-
* @property Book[] $reviewedBooks m:belongsToMany(reviewer_id)
45+
* @property int $id
46+
* @property string $name
47+
* @property Book[] $books m:belongsToMany
48+
* @property Book[] $reviewedBooks m:belongsToMany(reviewer_id)
4949
* @property string|NULL $web
5050
*/
5151
class Author extends Entity

tests/LeanMapperQuery/Query.joins.phpt

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,40 +11,39 @@ use Tester\Assert;
1111
require_once __DIR__ . '/../bootstrap.php';
1212

1313
/**
14-
* @property int $id
14+
* @property int $id
1515
* @property string $name
1616
*/
1717
class Tag extends Entity
1818
{
1919
}
2020

2121
/**
22-
* @property int $id
23-
* @property Author $author m:hasOne
24-
* @property Author|NULL $reviewer m:hasOne(reviewer_id)
25-
* @property Tag[] $tags m:hasMany
26-
* @property string $pubdate
27-
* @property string $name
22+
* @property int $id
23+
* @property Author $author m:hasOne
24+
* @property Author|NULL $reviewer m:hasOne(reviewer_id)
25+
* @property Tag[] $tags m:hasMany
26+
* @property string $pubdate
27+
* @property string $name
2828
* @property string|NULL $description
2929
* @property string|NULL $website
30-
* @property bool $available
30+
* @property bool $available
3131
*/
3232
class Book extends Entity
3333
{
3434
}
3535

3636
/**
37-
* @property int $id
38-
* @property string $name
39-
* @property Book[] $books m:belongsToMany
40-
* @property Book[] $reviewedBooks m:belongsToMany(reviewer_id)
37+
* @property int $id
38+
* @property string $name
39+
* @property Book[] $books m:belongsToMany
40+
* @property Book[] $reviewedBooks m:belongsToMany(reviewer_id)
4141
* @property string|NULL $web
4242
*/
4343
class Author extends Entity
4444
{
4545
}
4646

47-
4847
//////// Basic joins ////////
4948

5049
// HasOne relationship
@@ -81,7 +80,6 @@ $expected = getFluent('book')
8180
->where("([tag].[name] <> 'php')");
8281
Assert::same((string) $expected, (string) $fluent);
8382

84-
8583
//////// Multiple join of the same table ////////
8684

8785
$fluent = getFluent('book');
@@ -95,7 +93,6 @@ $expected = getFluent('book')
9593
->where("([author_reviewer_id].[web] = 'http://leanmapper.com')");
9694
Assert::same((string) $expected, (string) $fluent);
9795

98-
9996
//////// Optional specifying of primary key ////////
10097

10198
// HasOne

tests/LeanMapperQuery/Query.orderBy.phpt

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,25 @@ use Tester\Assert;
1111
require_once __DIR__ . '/../bootstrap.php';
1212

1313
/**
14-
* @property int $id
15-
* @property Author $author m:hasOne
16-
* @property string $name
14+
* @property int $id
15+
* @property Author $author m:hasOne
16+
* @property string $name
1717
* @property string|NULL $website
18-
* @property bool $available
18+
* @property bool $available
1919
*/
2020
class Book extends Entity
2121
{
2222
}
2323

2424
/**
25-
* @property int $id
26-
* @property string $name
25+
* @property int $id
26+
* @property string $name
2727
* @property string|NULL $web
2828
*/
2929
class Author extends Entity
3030
{
3131
}
3232

33-
3433
$fluent = getFluent('book');
3534
getQuery()
3635
->orderBy('@author.name')

tests/LeanMapperQuery/Query.ownCommandsAndMethods.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ class TestQuery extends Query
3232
}
3333

3434
/**
35-
* @property int $id
36-
* @property string $name
35+
* @property int $id
36+
* @property string $name
3737
* @property string|NULL $website
38-
* @property bool $available
38+
* @property bool $available
3939
*/
4040
class Book extends Entity
4141
{

tests/LeanMapperQuery/Query.where.phpt

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ class OtherDateTime extends DateTime
1616
}
1717

1818
/**
19-
* @property int $id
20-
* @property Tag[] $tags m:hasMany
21-
* @property DateTime $pubdate m:type(date)
19+
* @property int $id
20+
* @property Tag[] $tags m:hasMany
21+
* @property DateTime $pubdate m:type(date)
2222
* @property OtherDateTime $created
23-
* @property string $name
24-
* @property string|NULL $website
25-
* @property bool $available
23+
* @property string $name
24+
* @property string|NULL $website
25+
* @property bool $available
2626
*/
2727
class Book extends Entity
2828
{
2929
}
3030

3131
/**
32-
* @property int $id
32+
* @property int $id
3333
* @property string $name
3434
*/
3535
class Tag extends Entity
@@ -111,7 +111,6 @@ $expected = getFluent('book')
111111

112112
Assert::same($expected->_export(), $fluent->_export());
113113

114-
115114
// Test replacing instances of entities
116115
$tag = new Tag;
117116
$tag->makeAlive($entityFactory, $connection, $mapper);

tests/dependencies/Fluent.phpt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ $expected = array(
3232

3333
Assert::equal($fluent->_export('FROM'), $expected);
3434

35-
3635
// Test generated fluent by entity traversing
3736

3837
/**

0 commit comments

Comments
 (0)