/** * @test * @group url */ public function should_return_as_string() { $klimtoren = new URL('www.klimtoren.be'); $this->assertEquals('http://www.klimtoren.be/', $klimtoren->toString()); $this->assertEquals('http://www.klimtoren.be/', (string) $klimtoren); }
/** * @return URL */ public function url() { return URL::fromNative($this->url); }
/** * Find a website by it's url * * @param URL $URL * @return Website */ public function websiteOfURL(URL $URL) { $qb = $this->em->createQueryBuilder(); $qb->select('w, wo, l, t, i')->from($this->wsClass, 'w')->leftJoin('w.image', 'i')->leftJoin('w.objectives', 'wo')->leftJoin('wo.levels', 'l')->leftJoin('w.tags', 't')->where($qb->expr()->eq('w.url', '?1'))->setParameter(1, $URL->toString()); return $qb->getQuery()->getOneOrNullResult(); }