Pimcore\Model\Object\Classificationstore::setFieldname PHP Method

setFieldname() public method

public setFieldname ( string $fieldname )
$fieldname string
    public function setFieldname($fieldname)
    {
        $this->fieldname = $fieldname;
    }

Usage Example

 /**
  * @param $object
  * @param array $params
  * @return Object\Localizedfield
  * @throws \Exception
  */
 public function preGetData($object, $params = [])
 {
     if (!$object instanceof Object\Concrete) {
         throw new \Exception("Localized Fields are only valid in Objects");
     }
     if (!$object->{$this->getName()} instanceof Object\Classificationstore) {
         $store = new Object\Classificationstore();
         $store->setObject($object);
         $store->setFieldname($this->getName());
         $object->{$this->getName()} = $store;
     }
     return $object->{$this->getName()};
 }