How should pass a DomCrawler object as input parameter correctly? "Undefined property: Crawler::$extract "

When I pass the DomCralwer Object to my helper function:

function extractText(Crawler $crawler, $selector)
{
    $result = $crawler->filter($selector)->extract['_text'];
    return $result ? $result[0] : false;
}

it can not recognize the extract method on it:

Undefined property: SymfonyComponentDomCrawlerCrawler::$extract

Where is my problem?
I am quite new to php and symphony.

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *