/** * Test an empty Item entity */ public function testEmptyItem() { $item = new Item(); $this->assertNull($item->getId()); $this->assertEquals('New Item', $item->__toString()); $this->assertNull($item->getTitle()); $this->assertNull($item->getLatitude()); $this->assertNull($item->getLongitude()); $this->assertNull($item->getType()); $this->assertNull($item->getDescription()); $this->assertNull($item->getArea()); $this->assertNull($item->getAreaType()); $this->assertEquals(ItemStatusType::ACTUAL, $item->getStatus()); $this->assertTrue($item->isActive()); $this->assertNull($item->getDate()); $this->assertNull($item->getCreatedBy()); $this->assertFalse($item->isModerated()); $this->assertNull($item->getModeratedAt()); $this->assertFalse($item->isDeleted()); $this->assertNull($item->getActivatedAt()); $this->assertNull($item->getDeletedAt()); }
/** * Get item requests * * @param Item $item Item * * @return array */ public function getItemRequests(Item $item) { $qb = $this->createQueryBuilder('i'); return $qb->select('i.title')->addSelect('ir.createdAt AS createdAt')->addSelect('us.fullName AS userName')->addSelect('us.facebookId')->join('i.userRequests', 'ir')->join('ir.user', 'us')->where($qb->expr()->eq('i.id', ':id'))->setParameter('id', $item->getId())->getQuery()->getArrayResult(); }