Exemple #1
0
 protected function getAttributeValue()
 {
     $lv = new LegacyValue();
     $orm = \Database::connection()->getEntityManager();
     $genericValue = $orm->find('Concrete\\Core\\Entity\\Attribute\\Value\\Value\\Value', $this->getAttributeValueID());
     $lv->setGenericValue($genericValue);
     $lv->setAttributeKey($this->attributeKey);
     return $lv;
 }
Exemple #2
0
 public function getValueObject()
 {
     // First, retrieve the corresponding LegacyAttributeValue for this
     // object
     $lv = new LegacyValue();
     $orm = \Database::connection()->getEntityManager();
     $genericValue = $orm->find('Concrete\\Core\\Entity\\Attribute\\Value\\Value\\Value', $this->getAttributeValueID());
     $lv->setGenericValue($genericValue);
     $lv->setAttributeKey($this->attributeKey);
     return $lv->getValueObject();
 }
Exemple #3
0
 /**
  * @deprecated
  */
 public function addAttributeValue()
 {
     $orm = \Database::connection()->getEntityManager();
     $genericValue = new Value();
     $genericValue->setAttributeKey($this->legacyAttributeKey);
     $orm->persist($genericValue);
     $orm->flush();
     $value = new LegacyValue();
     $value->setAttributeKey($this->legacyAttributeKey);
     $value->setGenericValue($genericValue);
     return $value;
 }
 public function deleteKey(Key $key)
 {
     $values = $this->entityManager->getRepository('\\Concrete\\Core\\Entity\\Attribute\\Value\\Value\\Value')->findBy(['attribute_key' => $key]);
     $controller = $key->getController();
     foreach ($values as $genericValue) {
         $legacyValue = new LegacyValue();
         $legacyValue->setGenericValue($genericValue);
         $legacyValue->setAttributeKey($key);
         $controller->setAttributeValue($legacyValue);
         $controller->deleteValue();
         $value = $legacyValue->getValueObject();
         if (is_object($value)) {
             $this->entityManager->remove($value);
             $this->entityManager->flush();
         }
         $this->entityManager->remove($genericValue);
         $this->entityManager->flush();
     }
 }