private function addPropertyToGroup(ObjectManager $manager, ProfilePropertyGroup $group, ProfileProperty $property) { /** @var ProfileProperty $gprop */ foreach ($group->getProperties() as $gprop) { if ($gprop->getName() == $property->getName()) { return; } } $group->addProperty($property); }
public function handleFileUpload(ProfileProperty $property, UploadedFile $file) { if ($file->isValid()) { $opts = $property->getFieldOptions(); if (isset($opts['allowed_types'])) { $mime = $file->getMimeType(); if (!in_array($mime, $opts['allowed_types'])) { return false; } $this->uploader->setMimeTypes($opts['allowed_types']); } try { $url = $this->uploader->upload($file); return $url; } catch (\InvalidArgumentException $e) { return false; } } return false; }
/** * Remove properties * * @param ProfileProperty $properties */ public function removeProperty(ProfileProperty $property) { $property->removeGroup($this); $this->properties->removeElement($property); return $this; }