getPersistentFields

Retorna a relação de propriedades do active record com exceção dos do tipo de relacionamento hasMany

@return PropertyContract[]
334169
public function getPersistentFields()
    {
        if (empty($this->persistentFields)) {

            $persistentFields = $this->getPropertyContainer()->getFields('hasMany');
            if (!empty($persistentFields)) {
                $persistentFields = array_filter(
                    $persistentFields,
                    function (PropertyContract $property) {
                        if (!$property->getBehavior()->isPersistent()) {
                            return false;
                        }

                        if (!$property->getBehavior() instanceof IntegerBehavior) {
                            return true;
                        }

                        if ($property->getBehavior()->getIncrementalBehavior() == 'database') {
                            return false;
                        }

                        return true;
                    }
                );
            }
            $this->persistentFields = $persistentFields;
        }

        return $this->persistentFields;
    }
1293059
public List<PropertyType<PersistenceContextRefType<T>>> getAllPersistenceProperty()
   {
      List<PropertyType<PersistenceContextRefType<T>>> list = new ArrayList<PropertyType<PersistenceContextRefType<T>>>();
      List<Node> nodeList = childNode.get("persistence-property");
      for(Node node: nodeList)
      {
         PropertyType<PersistenceContextRefType<T>>  type = new PropertyTypeImpl<PersistenceContextRefType<T>>(this, "persistence-property", childNode, node);
         list.add(type);
      }
      return list;
   }
607009
protected function getPersistentValues(PersistentObject $object) {
    $values = [];

    // attribute definitions
    $attributeDescs = $this->getAttributes();
    foreach($attributeDescs as $curAttributeDesc) {
      if ($curAttributeDesc instanceof RDBAttributeDescription) {
        // add only attributes that are defined in the object
        $attribName = $curAttributeDesc->getName();
        //if ($object->hasValue($attribName)) {
          $values[$attribName] = $object->getValue($attribName);
        //}
      }
    }
    return $values;
  }
102272
protected function _getInstances()
    {
        $conditions = ['EavAttribute.table_alias' => $this->_tableAlias];
        if (!empty($this->_bundle)) {
            $conditions['EavAttribute.bundle'] = $this->_bundle;
        }

        $this->loadModel('Field.FieldInstances');

        return $this->FieldInstances
            ->find()
            ->contain(['EavAttribute'])
            ->where($conditions)
            ->order(['FieldInstances.ordering' => 'ASC'])
            ->all();
    }
942027
public function getInvalidFields()
    {
        $invalidFields = array();
        foreach ($this->currentFields as $field) {
            if (!$field->isValid) {
                $invalidFields[] = $field;
            }
        }
        return $invalidFields;
    }
631285
public function getRelations()
    {
        if (empty($this->_relations)) {
            $properties = $this->getInspector()->getClassProperties();
            foreach ($properties as $property) {
                $annotations = $this->getInspector()
                    ->getPropertyAnnotations($property);
                foreach (static::$_annotations as $name => $class) {
                    if ($annotations->hasAnnotation($name)) {
                        $this->_relations[$property] = call_user_func_array(
                            [$class, 'create'],
                            [
                                $annotations->getAnnotation($name),
                                $this->getEntity(),
                                trim($property, '_')
                            ]
                        );
                        break;
                    }
                }
            }
        }
        return $this->_relations;
    }
386897
public function fieldNames()
    {
        if ($this->hasProperty()) {
            $property = $this->property();
            if ($property instanceof StorablePropertyInterface) {
                return $property->fieldNames();
            } else {
                return [ $property ];
            }
        }

        return [];
    }
168224
public function getPropertyRelationMap(): array
    {
        $relations = [];

        foreach ($this->getRelationMappings() as $mapping) {
            $accessor = $mapping->getAccessor();

            if ($accessor instanceof PropertyAccessor) {
                $relations[$accessor->getPropertyName()] = $mapping->getRelation();
            }
        }

        return $relations;
    }
290153
protected function fieldsHaveBeenChanged()
    {
        $old = HighloadBlockTable::getById($this->id)->fetch();
        $new = $this->fields + ['ID' => (string) $this->id];

        return $new != $old;
    }
1067392
private function getOtherFieldNameInfo() {
		if ($this->otherInfo == null) {
			$propertyReader = function($name) {return $this->$name;	};

			$reader = $propertyReader->bindTo($this->intermediateMapper, $this->intermediateMapper);

			foreach ($reader('relations') as $relation) {
				$propertyReader = $propertyReader->bindTo($relation, $relation);
				if ($propertyReader('parentField') != $this->parentField) {
					$relation = $relation->getData($this->object);
					$this->otherInfo = [$propertyReader('localField'),  $propertyReader('parentField'), $propertyReader('mapper')];
				}
			}
		}
		return $this->otherInfo;
	}
701210
public function getCollectionsUsedByPrivateFields()
    {
        $map = [];

        foreach ($this->private as $name => $field) {
            $map[$name] = $field->getDependantCollections();
        }

        return $map;
    }
274805
public function getRelations()
    {
        $relations = $columns = [];

        /** @var Field $field */
        foreach ($this->builder->fields() as $field) {
            $columns[] = $field->column();
        }

        foreach (Arr::flatten($columns) as $column) {
            if (Str::contains($column, '.')) {
                list($relation) = explode('.', $column);

                if (method_exists($this->model, $relation) &&
                    $this->model->$relation() instanceof Relations\Relation
                ) {
                    $relations[] = $relation;
                }
            } elseif (method_exists($this->model, $column) &&
                !method_exists(Model::class, $column)
            ) {
                $relations[] = $column;
            }
        }

        return array_unique($relations);
    }
303291
protected function getPersistent()
    {
        $values = [];
        if ($this->getSessionStorage()->has('search')) {
            $values = $this->getSessionStorage()->get('search');
        }

        if (\array_key_exists($this->getEnvironment()->getDataDefinition()->getName(), $values)) {
            return $values[$this->getEnvironment()->getDataDefinition()->getName()];
        }

        return [];
    }
321837
protected function getFieldsExistingMessages()
    {
        $fieldsMessages = [];
        $formObject = $this->getFormObject();

        if ($formObject->formWasSubmitted()
            && $formObject->hasFormResult()
        ) {
            foreach ($this->getFormObject()->getConfiguration()->getFields() as $field) {
                $fieldsMessages[$field->getName()] = $this->getSingleFieldExistingMessages($field);
            }
        }

        return $fieldsMessages;
    }
766609
protected function getRelationFields() {
        $fields = [];
        foreach ($this->relations as $relation) {
            $fields = array_merge($fields, $relation->getLinkKeys());
        }
        return array_unique($fields);
    }
544159
private function getWhereClause(): array
    {
        $result = array_merge($this->getOwnerFields(), $this->getBelongTo(), $this->getPermissions());
        $result = array_merge($result, $this->getParentPermissions(), $this->getParentJoinsWhereClause());
        $result = array_merge_recursive($result, $this->getSupervisorWhereClause());

        return $result;
    }
1365250
protected function persistEntities($propertyValue)
    {
        if (!$propertyValue instanceof \Iterator && !is_array($propertyValue)) {
            $propertyValue = [$propertyValue];
        }
        foreach ($propertyValue as $possibleEntity) {
            if (is_object($possibleEntity) && $possibleEntity instanceof PersistenceMagicInterface) {
                $this->persistenceManager->isNewObject($possibleEntity) ? $this->persistenceManager->add($possibleEntity) : $this->persistenceManager->update($possibleEntity);

                // TODO: Needed because the originalAsset will not cascade persist. We should find a generic solution to this.
                if ($possibleEntity instanceof ImageVariant) {
                    $asset = $possibleEntity->getOriginalAsset();
                    $this->persistenceManager->isNewObject($asset) ? $this->persistenceManager->add($asset) : $this->persistenceManager->update($asset);
                }
            }
        }
    }