Pimcore\Model\Object\Classificationstore\CollectionConfig::getByName PHP Méthode

getByName() public static méthode

public static getByName ( $name, $storeId = 1 ) : CollectionConfig
$name
Résultat CollectionConfig
    public static function getByName($name, $storeId = 1)
    {
        try {
            $config = new self();
            $config->setName($name);
            $config->setStoreId($storeId ? $storeId : 1);
            $config->getDao()->getByName();
            return $config;
        } catch (\Exception $e) {
        }
    }

Usage Example

 public function createCollectionAction()
 {
     $name = $this->getParam("name");
     $alreadyExist = false;
     $config = Classificationstore\CollectionConfig::getByName($name);
     if (!$config) {
         $config = new Classificationstore\CollectionConfig();
         $config->setName($name);
         $config->save();
     }
     $this->_helper->json(array("success" => !$alreadyExist, "id" => $config->getName()));
 }
All Usage Examples Of Pimcore\Model\Object\Classificationstore\CollectionConfig::getByName