-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #79 from szymach/inheritance
Allow target field entity to exist in parent class as private
- Loading branch information
Showing
4 changed files
with
136 additions
and
9 deletions.
There are no files selected for viewing
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
19 changes: 19 additions & 0 deletions
19
tests/FSi/DoctrineExtensions/Tests/Uploadable/Fixture/Inheritance/Employee.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,19 @@ | ||
<?php | ||
|
||
/** | ||
* (c) FSi sp. z o.o. <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FSi\DoctrineExtensions\Tests\Uploadable\Fixture\Inheritance; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity | ||
*/ | ||
class Employee extends Person | ||
{ | ||
} |
69 changes: 69 additions & 0 deletions
69
tests/FSi/DoctrineExtensions/Tests/Uploadable/Fixture/Inheritance/Person.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,69 @@ | ||
<?php | ||
|
||
/** | ||
* (c) FSi sp. z o.o. <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace FSi\DoctrineExtensions\Tests\Uploadable\Fixture\Inheritance; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
use FSi\DoctrineExtensions\Uploadable\File; | ||
use FSi\DoctrineExtensions\Uploadable\Mapping\Annotation as FSi; | ||
use SplFileInfo; | ||
|
||
/** | ||
* @ORM\Entity | ||
* @ORM\InheritanceType("SINGLE_TABLE") | ||
* @ORM\DiscriminatorColumn(name="discr", type="string") | ||
* @ORM\DiscriminatorMap({"person" = "Person", "employee" = "Employee"}) | ||
*/ | ||
class Person | ||
{ | ||
/** | ||
* @var integer | ||
* | ||
* @ORM\Column(name="id", type="integer") | ||
* @ORM\Id | ||
* @ORM\GeneratedValue(strategy="AUTO") | ||
*/ | ||
private $id; | ||
|
||
/** | ||
* @ORM\Column(nullable=true) | ||
* @FSi\Uploadable(targetField="file") | ||
*/ | ||
private $filePath; | ||
|
||
/** | ||
* @var File|SplFileInfo | ||
*/ | ||
private $file; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
|
||
public function getFilePath() | ||
{ | ||
return $this->filePath; | ||
} | ||
|
||
public function setFilePath($filePath) | ||
{ | ||
$this->filePath = $filePath; | ||
} | ||
|
||
public function getFile() | ||
{ | ||
return $this->file; | ||
} | ||
|
||
public function setFile($file) | ||
{ | ||
$this->file = $file; | ||
} | ||
} |
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