-
-
Notifications
You must be signed in to change notification settings - Fork 405
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ask the user if they want the inverse side of a relation
- Loading branch information
1 parent
2fd2e0c
commit c3ccf5f
Showing
4 changed files
with
126 additions
and
19 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
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
23 changes: 23 additions & 0 deletions
23
tests/fixtures/MakeEntityManyToOneNoInverse/src/Entity/User.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,23 @@ | ||
<?php | ||
|
||
namespace App\Entity; | ||
|
||
use Doctrine\ORM\Mapping as ORM; | ||
|
||
/** | ||
* @ORM\Entity() | ||
*/ | ||
class User | ||
{ | ||
/** | ||
* @ORM\Id | ||
* @ORM\GeneratedValue | ||
* @ORM\Column(type="integer") | ||
*/ | ||
private $id; | ||
|
||
public function getId() | ||
{ | ||
return $this->id; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
tests/fixtures/MakeEntityManyToOneNoInverse/tests/GeneratedEntityTest.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,36 @@ | ||
<?php | ||
|
||
namespace App\Tests; | ||
|
||
use Doctrine\Common\Collections\ArrayCollection; | ||
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | ||
use Doctrine\ORM\EntityManager; | ||
use App\Entity\User; | ||
use App\Entity\UserAvatarPhoto; | ||
|
||
class GeneratedEntityTest extends KernelTestCase | ||
{ | ||
public function testGeneratedEntity() | ||
{ | ||
self::bootKernel(); | ||
/** @var EntityManager $em */ | ||
$em = self::$kernel->getContainer() | ||
->get('doctrine') | ||
->getManager(); | ||
|
||
$em->createQuery('DELETE FROM App\\Entity\\User u')->execute(); | ||
$em->createQuery('DELETE FROM App\\Entity\\UserAvatarPhoto u')->execute(); | ||
|
||
$user = new User(); | ||
$em->persist($user); | ||
|
||
$photo = new UserAvatarPhoto(); | ||
$photo->setUser($user); | ||
$em->persist($photo); | ||
|
||
$em->flush(); | ||
$em->refresh($photo); | ||
|
||
$this->assertSame($photo->getUser(), $user); | ||
} | ||
} |