public function addKey(SetEntity $set, Key $key)
 {
     $displayOrder = 0;
     $keys = $set->getAttributeKeys();
     if (count($keys) > 0) {
         $displayOrder = count($keys);
     }
     $r = $this->entityManager->getRepository('Concrete\\Core\\Entity\\Attribute\\SetKey');
     $setKey = $r->findOneBy(array('attribute_key' => $key, 'set' => $set));
     if (!is_object($setKey)) {
         $setKey = new SetKey();
         $setKey->setAttributeKey($key);
         $setKey->setAttributeSet($set);
         $setKey->setDisplayOrder($displayOrder);
         $set->getAttributeKeyCollection()->add($setKey);
         $this->entityManager->persist($setKey);
         $this->entityManager->flush();
     }
 }
Beispiel #2
0
 /**
  * @deprecated
  */
 public function setAttributeSet($set)
 {
     if (!is_object($set)) {
         $set = Set::getByHandle($set);
     }
     $set->addKey($this);
 }