/**
  * Declares an association between this object and a ProfileProperty object.
  *
  * @param      ProfileProperty $v
  * @return     void
  * @throws     PropelException
  */
 public function setProfileProperty($v)
 {
     if ($v === null) {
         $this->setProfilePropertyId(NULL);
     } else {
         $this->setProfilePropertyId($v->getId());
     }
     $this->aProfileProperty = $v;
 }
Ejemplo n.º 2
0
    /**
     * @param \ConceptProperty | \ConceptProperty[] $dbElement
     * @param                                       $value
     * @param                                       $rowStatus
     * @param \Concept                              $concept
     * @param \ProfileProperty                      $profileProperty
     * @param                                       $language
     *
     * @param                                       $key
     *
     * @return bool
     * @throws \PropelException
     */
    private function upsertConceptFromRow(
        &$dbElement,
        $value,
        $rowStatus,
        &$concept,
        $profileProperty,
        $language,
        $key
    ) {
        //set the keys to skip, because concepts don't maintain uri and status separately
        $skipKeys = [ 59, 62 ];
        if (in_array($key, $skipKeys)) {
            return true;
        }
        if ( ! is_array($dbElement)) {
            if (empty( $dbElement ) and $value) {
                $dbElement = new \ConceptProperty();
                $dbElement->setSkosPropertyId($profileProperty->getSkosId());
                $dbElement->setConceptId($concept->getId());
                $dbElement->setLanguage($language);
                $dbElement->setCreatedUserId($this->userId);
                $concept->addConceptPropertyRelatedByConceptId($dbElement);
            }

            if ($dbElement and $value !== $dbElement->getObject()) {
                if (empty( $value )) {
                    $dbElement->delete();
                } else {
                    $dbElement->setStatusId($rowStatus);
                    $dbElement->setObject($value);
                    $dbElement->setUpdatedUserId($this->userId);
                    $dbElement->importId = $this->importId;
                    $dbElement->setDeletedAt(null);
                }

                //$dbElement->save();
                if ($profileProperty->getIsInForm()) {
                    if (( $profileProperty->getHasLanguage() and $concept->getLanguage() == $dbElement->getLanguage() ) or ! $profileProperty->getHasLanguage()) {
                        $this->setConceptValue($value,
                                               $concept,
                                               $profileProperty->getName(), ! $profileProperty->getIsObjectProp(),
                                               $key);
                      $dbElement->setIsConceptProperty(true);
                    }
                }

                return true;
            }
        } else {
            $foundOne = false;
            foreach ($dbElement as &$oneElement) {
                if ( ! $foundOne) {
                    $foundOne = $this->upsertConceptFromRow($oneElement,
                                                            $value,
                                                            $rowStatus,
                                                            $concept,
                                                            $profileProperty,
                                                            $language,
                                                            $key);
                }
            }
        }

        return true;
    }
Ejemplo n.º 3
0
 /**
  * Method called to associate a ProfileProperty object to this object
  * through the ProfileProperty foreign key attribute
  *
  * @param      ProfileProperty $l ProfileProperty
  * @return     void
  * @throws     PropelException
  */
 public function addProfilePropertyRelatedByDeletedBy(ProfileProperty $l)
 {
     $this->collProfilePropertysRelatedByDeletedBy[] = $l;
     $l->setUserRelatedByDeletedBy($this);
 }
 /**
  * Method called to associate a ProfileProperty object to this object
  * through the ProfileProperty foreign key attribute
  *
  * @param      ProfileProperty $l ProfileProperty
  * @return     void
  * @throws     PropelException
  */
 public function addProfilePropertyRelatedByInverseProfilePropertyId(ProfileProperty $l)
 {
     $this->collProfilePropertysRelatedByInverseProfilePropertyId[] = $l;
     $l->setProfilePropertyRelatedByInverseProfilePropertyId($this);
 }
Ejemplo n.º 5
0
 /**
  * Method called to associate a ProfileProperty object to this object
  * through the ProfileProperty foreign key attribute
  *
  * @param      ProfileProperty $l ProfileProperty
  * @return     void
  * @throws     PropelException
  */
 public function addProfileProperty(ProfileProperty $l)
 {
     $this->collProfilePropertys[] = $l;
     $l->setProfile($this);
 }