@@ -31,7 +31,7 @@ |
||
| 31 | 31 | /** |
| 32 | 32 | * @var string |
| 33 | 33 | */ |
| 34 | - protected $targetClass= ''; |
|
| 34 | + protected $targetClass = ''; |
|
| 35 | 35 | |
| 36 | 36 | /** |
| 37 | 37 | * If false, $source is "User" (class with HasOne/HasMany posts()) |
@@ -41,19 +41,19 @@ |
||
| 41 | 41 | )) { |
| 42 | 42 | $mode = null; |
| 43 | 43 | switch ($matches['mode']) { |
| 44 | - case '11': |
|
| 45 | - $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
| 46 | - break; |
|
| 47 | - case '1N': |
|
| 48 | - $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
| 49 | - break; |
|
| 50 | - case 'NN': |
|
| 51 | - case 'N1': // TODO |
|
| 52 | - $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
| 53 | - break; |
|
| 54 | - // TODO: morph |
|
| 55 | - default: |
|
| 56 | - throw new ClassNotFoundException('Invalid relationship'); |
|
| 44 | + case '11': |
|
| 45 | + $mode = self::RELATIONSHIP_ONE_TO_ONE; |
|
| 46 | + break; |
|
| 47 | + case '1N': |
|
| 48 | + $mode = self::RELATIONSHIP_ONE_TO_MANY; |
|
| 49 | + break; |
|
| 50 | + case 'NN': |
|
| 51 | + case 'N1': // TODO |
|
| 52 | + $mode = self::RELATIONSHIP_MANY_TO_MANY; |
|
| 53 | + break; |
|
| 54 | + // TODO: morph |
|
| 55 | + default: |
|
| 56 | + throw new ClassNotFoundException('Invalid relationship'); |
|
| 57 | 57 | } |
| 58 | 58 | return static::factory($matches['source'], $matches['target'], $mode, (bool)$matches['inverse']); |
| 59 | 59 | } |
@@ -16,10 +16,10 @@ discard block |
||
| 16 | 16 | public const RELATIONSHIP = "RELATIONSHIP"; |
| 17 | 17 | public const RELATIONSHIP_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
| 18 | 18 | public const RELATIONSHIP_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
| 19 | - public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
| 19 | + public const RELATIONSHIP_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
| 20 | 20 | public const MORPH_ONE_TO_ONE = "RELATIONSHIP_ONE_TO_ONE"; |
| 21 | 21 | public const MORPH_ONE_TO_MANY = "RELATIONSHIP_ONE_TO_MANY"; |
| 22 | - public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
| 22 | + public const MORPH_MANY_TO_MANY = "RELATIONSHIP_MANY_TO_MANY"; |
|
| 23 | 23 | private function __construct() |
| 24 | 24 | { |
| 25 | 25 | // nothing |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | default: |
| 56 | 56 | throw new ClassNotFoundException('Invalid relationship'); |
| 57 | 57 | } |
| 58 | - return static::factory($matches['source'], $matches['target'], $mode, (bool)$matches['inverse']); |
|
| 58 | + return static::factory($matches['source'], $matches['target'], $mode, (bool) $matches['inverse']); |
|
| 59 | 59 | } |
| 60 | 60 | throw new ClassNotFoundException('Invalid relationship'); |
| 61 | 61 | } |