public function testGetSetHasId() { $this->assertFalse($this->criteria->hasId()); $this->criteria->setId(100); $this->assertTrue($this->criteria->hasId()); $this->assertEquals(100, $this->criteria->getId()); }
/** * @param int $id * @return User|null */ public function findUserById($id) { $criteria = new UserCriteria(); $criteria->setId($id); $results = $this->getUserRepository()->findByCriteria($criteria); return count($results) ? $results[0] : null; }