public function createControlByIdentifier($id)
 {
     $r = $this->entityManager->getRepository('\\Concrete\\Core\\Entity\\Express\\Association');
     $association = $r->findOneById($id);
     $control = new AssociationControl();
     $control->setAssociation($association);
     return $control;
 }
 public function getEntryDisplayName(AssociationControl $control, Entry $entry)
 {
     // Do we have a custom display mask? If so, we try to use that
     if ($control->getAssociationEntityLabelMask()) {
         try {
             return preg_replace_callback('/%(.*?)%/i', function ($matches) use($entry) {
                 return $entry->getAttribute($matches[1]);
             }, $control->getAssociationEntityLabelMask());
         } catch (\Exception $e) {
         }
     }
     $targetEntity = $this->association->getTargetEntity();
     $attribute = $targetEntity->getAttributes()[0];
     if (is_object($attribute)) {
         return $entry->getAttribute($attribute);
     }
 }