/** * @return StorageLocationInterface */ public function getStorageLocation() { if ($this->storageLocation === null) { $this->setStorageLocation(StorageLocation::getDefault()); } return $this->storageLocation; }
/** * (non-PHPdoc) * @see de\RaumZeitLabor\PartKeepr\Util.Serializable::serialize() */ public function serialize () { $aManufacturers = array(); foreach ($this->getManufacturers() as $manufacturer) { $aManufacturers[] = $manufacturer->serialize(); } $aDistributors = array(); foreach ($this->getDistributors() as $distributor) { $aDistributors[] = $distributor->serialize(); } $aParameters = array(); foreach ($this->getParameters() as $parameter) { $aParameters[] = $parameter->serialize(); } $aImages = array(); foreach ($this->getImages() as $image) { $aImages[] = $image->serialize(); } $aAttachments = array(); foreach ($this->getAttachments() as $attachment) { $aAttachments[] = $attachment->serialize(); } return array( "id" => $this->getId(), "name" => $this->getName(), "comment" => $this->getComment(), "stockLevel" => $this->getStockLevel(), "footprint_id" => is_object($this->footprint) ? $this->footprint->getId() : null, "minStockLevel" => $this->minStockLevel, "storageLocation_id" => is_object($this->storageLocation) ? $this->storageLocation->getId() : null, "storageLocationName" => is_object($this->storageLocation) ? $this->storageLocation->getName() : null, "category_id" => is_object($this->category) ? $this->category->getId() : null, "partUnit_id" => is_object($this->partUnit) ? $this->getPartUnit()->getId() : null, "partUnit_name" => is_object($this->partUnit) ? $this->getPartUnit()->getId() : PartKeepr::i18n("Pieces"), "partUnit_shortName" => is_object($this->partUnit) ? $this->getPartUnit()->getId() : "", "manufacturers" => $aManufacturers, "distributors" => $aDistributors, "images" => $aImages, "attachments" => $aAttachments, "parameters" => $aParameters ); }
//get all authentication types for output in drop down $authenticationTypeArray = array(); $authenticationTypeObj = new AuthenticationType(); $authenticationTypeArray = $authenticationTypeObj->allAsArray(); //get all access methods for output in drop down $accessMethodArray = array(); $accessMethodObj = new AccessMethod(); $accessMethodArray = $accessMethodObj->allAsArray(); //get all user limits for output in drop down //overridden for better sort $userLimitArray = array(); $userLimitObj = new UserLimit(); $userLimitArray = $userLimitObj->allAsArray(); //get all storage locations for output in drop down $storageLocationArray = array(); $storageLocationObj = new StorageLocation(); $storageLocationArray = $storageLocationObj->allAsArray(); //get all administering sites for output in checkboxes $administeringSiteArray = array(); $administeringSiteObj = new AdministeringSite(); $administeringSiteArray = $administeringSiteObj->allAsArray(); //get administering sites for this resource $sanitizedInstance = array(); $instance = new AdministeringSite(); $resourceAdministeringSiteArray = array(); foreach ($resource->getResourceAdministeringSites() as $instance) { $resourceAdministeringSiteArray[] = $instance->administeringSiteID; } //get all authorized sites for output in checkboxes $authorizedSiteArray = array(); $authorizedSiteObj = new AuthorizedSite();
protected function handleStorageLocation() { // parent::handleStorageLocation(); $storageLocation = null; $storageLocationData = $this->currentCdata; if (isset($storageLocationData) == true) { $storageLocation = $this->entityManager->getRepository('StorageLocation')->findOneBy(array('storageLocation' => $storageLocationData)); } else { // empty element so do nothing return; } if (is_null($storageLocation) == true) { $storageLocation = new StorageLocation(); $storageLocation->setStorageLocation($this->currentCdata); $this->entityManager->persist($storageLocation); // $this->entityManager->flush(); $this->logger->trace('Persisting storageLocation to database. Method (' . __METHOD__ . ')' . $storageLocation); } $parentObject = prev($this->stack); $storageLocationUsingObject = end($this->stack); if ($storageLocationUsingObject instanceof DocumentDescription) { // Associate this storageLocation object with the current documentDescription object $parentObject->addReferenceStorageLocation($storageLocation); $storageLocation->addReferenceDocumentDescription($parentObject); $this->logger->trace('In method ' . __METHOD__ . '. Associating storageLocation ' . $storageLocation . ' with DocumentDescription ' . $parentObject); } elseif ($storageLocationUsingObject instanceof BasicRecord) { // Associate this storageLocation object with the current Record->BaiscRecord object $parentObject->addReferenceStorageLocation($storageLocation); $storageLocation->addReferenceBasicRecord($parentObject); $this->logger->trace('In method ' . __METHOD__ . '. Associating storageLocation ' . $storageLocation . ' with basicrecord ' . $parentObject); } elseif ($storageLocationUsingObject instanceof File) { // Associate this storageLocation object with the current File object $parentObject->addReferenceStorageLocation($storageLocation); $storageLocation->addReferenceFile($parentObject); $this->logger->trace('In method ' . __METHOD__ . '. Associating storageLocation ' . $storageLocation . ' with file ' . $parentObject); } elseif ($storageLocationUsingObject instanceof Series) { // Associate this storageLocation object with the current series object $parentObject->addReferenceStorageLocation($storageLocation); $storageLocation->addReferenceSeries($parentObject); $this->logger->trace('In method ' . __METHOD__ . '. Associating storageLocation ' . $storageLocation . ' with series ' . $parentObject); } elseif ($storageLocationUsingObject instanceof Fonds) { // Associate this storageLocation object with the current fonds object $storageLocation->addReferenceFonds($parentObject); $this->logger->trace('In method ' . __METHOD__ . '. Associating storageLocation ' . $storageLocation . ' with fonds ' . $parentObject); } else { throw new Exception(Constants::STACK_ERROR . __METHOD__ . ". Found a storage location associated with a " . get_class(end($this->stack)) . " object but according to n5 standard, this object cannot be associated with a storage location"); } // $this->entityManager->merge($storageLocation); $this->entityManager->flush(); $this->logger->trace('Merging updated storageLocation to database. Method (' . __METHOD__ . ')' . $storageLocation); }