src/Service/Filler.php
private function getStudio(\DOMXPath $xpath, \DOMNode $body)
    {
        $studios = $xpath->query('//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]', $body);
        if ($studios->length) {
            foreach ($studios as $studio) {
                $url = $studio->attributes->getNamedItem('src')->nodeValue;
                if (preg_match('/\/(\d+)\./', $url, $mat) && isset($this->studios[$mat[1]])) {
                    return $this->doctrine
                        ->getRepository('AnimeDbCatalogBundle:Studio')
                        ->findOneByName($this->studios[$mat[1]]);
                }
            }
        }
    }
private function getStudio(\DOMXPath $xpath, \DOMNode $body)
    {
        $studios = $xpath->query('//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]', $body);
        if ($studios->length) {
            foreach ($studios as $studio) {
                $url = $studio->attributes->getNamedItem('src')->nodeValue;
                if (preg_match('/\/(\d+)\./', $url, $mat) && isset($this->studios[$mat[1]])) {
                    return $this->doctrine
                        ->getRepository('AnimeDbCatalogBundle:Studio')
                        ->findOneByName($this->studios[$mat[1]]);
                }
            }
        }
    }
private function getStudio ( \ DOMXPath $ xpath , \ DOMNode $ body ) { $ studios = $ xpath -> query ( '//img[starts-with(@src,"http://www.world-art.ru/img/company_new/")]' , $ body ) ; if ( $ studios -> length ) { foreach ( $ studios as $ studio ) { $ url = $ studio -> attributes -> getNamedItem ( 'src' ) -> nodeValue ; if ( preg_match ( '/\/(\d+)\./' , $ url , $ mat ) && isset ( $ this -> studios [ $ mat [ 1 ] ] ) ) { return $ this -> doctrine -> getRepository ( 'AnimeDbCatalogBundle:Studio' ) -> findOneByName ( $ this -> studios [ $ mat [ 1 ] ] ) ; } } } }
Get item studio.

@param \DOMXPath $xpath
@param \DOMNode  $body

@return \AnimeDb\Bundle\CatalogBundle\Entity\Studio|null
Get item studio .