1 | <?php |
||||||
2 | |||||||
3 | namespace Doctrine\Tests\ORM\Functional\Ticket; |
||||||
4 | |||||||
5 | |||||||
6 | use Doctrine\Common\Collections\Criteria; |
||||||
7 | use Doctrine\Tests\Models\Company\CompanyFlexContract; |
||||||
8 | use Doctrine\Tests\Models\Company\CompanyManager; |
||||||
9 | |||||||
10 | /** |
||||||
11 | * @author Jean Carlo Machado <[email protected]> |
||||||
12 | */ |
||||||
13 | class DDC3719Test extends \Doctrine\Tests\OrmFunctionalTestCase |
||||||
14 | { |
||||||
15 | public function setUp() |
||||||
16 | { |
||||||
17 | $this->useModelSet('company'); |
||||||
18 | parent::setUp(); |
||||||
19 | } |
||||||
20 | |||||||
21 | /** |
||||||
22 | * @group DDC-3719 |
||||||
23 | */ |
||||||
24 | public function testCriteriaOnNotOwningSide() |
||||||
25 | { |
||||||
26 | $manager = new CompanyManager(); |
||||||
27 | $manager->setName('Gandalf'); |
||||||
28 | $manager->setSalary(666); |
||||||
29 | $manager->setTitle('Boss'); |
||||||
30 | $manager->setDepartment('Marketing'); |
||||||
31 | $this->_em->persist($manager); |
||||||
32 | |||||||
33 | $contractA = new CompanyFlexContract(); |
||||||
34 | $contractA->markCompleted(); |
||||||
35 | $contractA->addManager($manager); |
||||||
36 | $this->_em->persist($contractA); |
||||||
37 | |||||||
38 | $contractB = new CompanyFlexContract(); |
||||||
39 | $contractB->addManager($manager); |
||||||
40 | $this->_em->persist($contractB); |
||||||
41 | |||||||
42 | $this->_em->flush(); |
||||||
43 | $this->_em->refresh($manager); |
||||||
44 | |||||||
45 | $contracts = $manager->managedContracts; |
||||||
46 | static::assertCount(2, $contracts); |
||||||
47 | |||||||
48 | $criteria = Criteria::create(); |
||||||
49 | $criteria->where(Criteria::expr()->eq("completed", true)); |
||||||
50 | |||||||
51 | $completedContracts = $contracts->matching($criteria); |
||||||
0 ignored issues
–
show
Bug
introduced
by
Loading history...
The method
matching() does not exist on Traversable . It seems like you code against a sub-type of Traversable such as Doctrine\Common\Collections\ArrayCollection or Doctrine\ORM\PersistentCollection or Doctrine\ORM\LazyCriteriaCollection .
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
52 | static::assertCount(1, $completedContracts); |
||||||
53 | } |
||||||
54 | } |
||||||
55 |