Skip to content

Commit 8940ccb

Browse files
committed
Merge branch 'develop'
2 parents 6d95e93 + 4558f97 commit 8940ccb

37 files changed

+525
-112
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ php:
88
- 7.2
99

1010
script:
11-
- vendor/bin/tester tests -s -p php -c tests/php-unix.ini
11+
- vendor/bin/tester tests -s -p php
1212
- if [ "$TRAVIS_PHP_VERSION" = "7.2" ]; then php temp/code-checker/src/code-checker.php; fi
1313

1414
after_failure:

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Lean Mapper
55

66
[![Build Status](https://travis-ci.org/Tharos/LeanMapper.svg?branch=develop)](https://travis-ci.org/Tharos/LeanMapper)
77

8-
Lean Mapper is a tiny ORM based on powerful [dibi database abstraction library](http://dibiphp.com) for PHP.
8+
Lean Mapper is a tiny ORM based on powerful [Dibi database abstraction library](http://dibiphp.com) for PHP.
99

1010
See [www.leanmapper.com](http://www.leanmapper.com) for more informations, usage examples and documentation.
1111

src/LeanMapper/DefaultMapper.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,9 +92,10 @@ public function getRelationshipTable($sourceTable, $targetTable)
9292
/**
9393
* {@inheritdoc}
9494
*/
95-
public function getRelationshipColumn($sourceTable, $targetTable)
95+
public function getRelationshipColumn($sourceTable, $targetTable/*, $relationshipName = null*/)
9696
{
97-
return $targetTable . '_' . $this->getPrimaryKey($targetTable);
97+
$relationshipName = (func_num_args() === 3) ? func_get_arg(2) : null;
98+
return (isset($relationshipName) ? $relationshipName : $targetTable) . '_' . $this->getPrimaryKey($targetTable);
9899
}
99100

100101

@@ -126,7 +127,7 @@ public function getImplicitFilters($entityClass, Caller $caller = null)
126127
/**
127128
* Trims namespace part from fully qualified class name
128129
*
129-
* @param $class
130+
* @param string $class
130131
* @return string
131132
*/
132133
protected function trimNamespace($class)

src/LeanMapper/Entity.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,16 @@ abstract class Entity
3939
/** @var Row */
4040
protected $row;
4141

42-
/** @var IMapper */
42+
/** @var IMapper|null */
4343
protected $mapper;
4444

45-
/** @var IEntityFactory */
45+
/** @var IEntityFactory|null */
4646
protected $entityFactory;
4747

4848
/** @var EntityReflection[] */
4949
protected static $reflections = [];
5050

51-
/** @var EntityReflection */
51+
/** @var EntityReflection|null */
5252
private $currentReflection;
5353

5454

@@ -506,7 +506,7 @@ public function __sleep()
506506

507507

508508
/**
509-
* @param $property
509+
* @param Property|string $property
510510
* @param array $filterArgs
511511
* @throws InvalidValueException
512512
* @throws InvalidStateException
@@ -858,7 +858,7 @@ protected function initDefaults()
858858
* @param Relationship\HasOne $relationship micro-optimalization
859859
* @param Filtering|null $filtering
860860
* @throws InvalidValueException
861-
* @return Entity
861+
* @return Entity|null
862862
*/
863863
private function getHasOneValue(Property $property, Relationship\HasOne $relationship, Filtering $filtering = null)
864864
{
@@ -924,7 +924,7 @@ private function getHasManyValue(
924924
* @param Property $property
925925
* @param Relationship\BelongsToOne $relationship micro-optimalization
926926
* @param Filtering|null $filtering
927-
* @return Entity
927+
* @return Entity|null
928928
* @throws InvalidValueException
929929
*/
930930
private function getBelongsToOneValue(Property $property, Relationship\BelongsToOne $relationship, Filtering $filtering = null)

src/LeanMapper/Filtering.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class Filtering
4545
* @param array|null $args
4646
* @param Entity|null $entity
4747
* @param Property|null $property
48-
* @param array|null $targetedArgs
48+
* @param array $targetedArgs
4949
* @throws InvalidArgumentException
5050
*/
5151
public function __construct($filters, array $args = null, Entity $entity = null, Property $property = null, array $targetedArgs = [])

src/LeanMapper/Fluent.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Fluent extends \Dibi\Fluent
3333
'DELETE' => ['DELETE', 'FROM', 'USING', 'WHERE', 'ORDER BY', 'LIMIT'],
3434
];
3535

36-
/** @var array */
36+
/** @var array|null */
3737
private $relatedKeys;
3838

3939

@@ -73,7 +73,7 @@ public function createSelect($args = null)
7373
*
7474
* @param string|null $clause
7575
* @param array|null $args
76-
* @return string
76+
* @return array
7777
*/
7878
public function _export($clause = null, $args = null)
7979
{

src/LeanMapper/IMapper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,10 @@ public function getRelationshipTable($sourceTable, $targetTable);
8888
*
8989
* @param string $sourceTable
9090
* @param string $targetTable
91+
* @param string|null $relationshipName
9192
* @return string
9293
*/
93-
public function getRelationshipColumn($sourceTable, $targetTable);
94+
public function getRelationshipColumn($sourceTable, $targetTable/*, $relationshipName = null*/);
9495

9596

9697

src/LeanMapper/ImplicitFilters.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class ImplicitFilters
3232

3333
/**
3434
* @param array|string|Closure $filters
35-
* @param array|null $targetedArgs
35+
* @param array $targetedArgs
3636
* @throws InvalidArgumentException
3737
*/
3838
public function __construct($filters, array $targetedArgs = [])

src/LeanMapper/Reflection/AliasesParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function __construct()
4646
*
4747
* @param string $source
4848
* @param string $namespace
49-
* @return array
49+
* @return Aliases
5050
*/
5151
public static function parseSource($source, $namespace = '')
5252
{

src/LeanMapper/Reflection/AnnotationsParser.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,20 @@ public static function parseAnnotationValues($annotation, $docComment)
6161
return $matches[1];
6262
}
6363

64+
65+
66+
/**
67+
* Parse value pieces of requested multiline annotation from given doc comment
68+
*
69+
* @param string $annotation
70+
* @param string $docComment
71+
* @return array
72+
*/
73+
public static function parseMultiLineAnnotationValues($annotation, $docComment)
74+
{
75+
$matches = [];
76+
preg_match_all("#@$annotation\\h+([^\n\r@]+(?:\\s*\*\\h{2,}+[^\n\r@]+)*)#", $docComment, $matches);
77+
return $matches[1];
78+
}
79+
6480
}

0 commit comments

Comments
 (0)