Sulu\Component\Webspace\Manager\WebspaceManager::findWebspaceByKey PHP Метод

findWebspaceByKey() публичный Метод

Returns the webspace with the given key.
public findWebspaceByKey ( $key ) : Webspace
$key string The key to search for
Результат Sulu\Component\Webspace\Webspace
    public function findWebspaceByKey($key)
    {
        return $this->getWebspaceCollection()->getWebspace($key);
    }

Usage Example

Пример #1
0
 public function testLocalizations()
 {
     $localizations = $this->webspaceManager->findWebspaceByKey('massiveart')->getLocalizations();
     $this->assertEquals('en', $localizations[0]->getLanguage());
     $this->assertEquals('us', $localizations[0]->getCountry());
     $this->assertEquals('auto', $localizations[0]->getShadow());
     $this->assertEquals(1, count($localizations[0]->getChildren()));
     $this->assertEquals('en', $localizations[0]->getChildren()[0]->getLanguage());
     $this->assertEquals('ca', $localizations[0]->getChildren()[0]->getCountry());
     $this->assertEquals(null, $localizations[0]->getChildren()[0]->getShadow());
     $this->assertEquals('en', $localizations[0]->getChildren()[0]->getParent()->getLanguage());
     $this->assertEquals('us', $localizations[0]->getChildren()[0]->getParent()->getCountry());
     $this->assertEquals('auto', $localizations[0]->getChildren()[0]->getParent()->getShadow());
     $this->assertEquals('fr', $localizations[1]->getLanguage());
     $this->assertEquals('ca', $localizations[1]->getCountry());
     $this->assertEquals(null, $localizations[1]->getShadow());
     $allLocalizations = $this->webspaceManager->findWebspaceByKey('massiveart')->getAllLocalizations();
     $this->assertEquals('en', $allLocalizations[0]->getLanguage());
     $this->assertEquals('us', $allLocalizations[0]->getCountry());
     $this->assertEquals('auto', $allLocalizations[0]->getShadow());
     $this->assertEquals('en', $allLocalizations[1]->getLanguage());
     $this->assertEquals('ca', $allLocalizations[1]->getCountry());
     $this->assertEquals(null, $allLocalizations[1]->getShadow());
     $this->assertEquals('fr', $allLocalizations[2]->getLanguage());
     $this->assertEquals('ca', $allLocalizations[2]->getCountry());
     $this->assertEquals(null, $allLocalizations[2]->getShadow());
 }