本文整理汇总了PHP中RedBeanModel::isAttributeRequired方法的典型用法代码示例。如果您正苦于以下问题:PHP RedBeanModel::isAttributeRequired方法的具体用法?PHP RedBeanModel::isAttributeRequired怎么用?PHP RedBeanModel::isAttributeRequired使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RedBeanModel
的用法示例。
在下文中一共展示了RedBeanModel::isAttributeRequired方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolveDynamicallyDerivedAttributesForActionsOrTimeTriggerData
/**
* @param boolean $includeRequired
* @param boolean $includeNonRequired
* @param $includeReadOnly
* @return array
*/
protected function resolveDynamicallyDerivedAttributesForActionsOrTimeTriggerData($includeRequired = false, $includeNonRequired = false, $includeReadOnly = false)
{
assert('is_bool($includeRequired)');
assert('is_bool($includeNonRequired)');
assert('is_bool($includeReadOnly)');
$attributes = array();
foreach ($this->model->getAttributes() as $attribute => $notUsed) {
if (!$this->model instanceof User && $this->model->isRelation($attribute) && (!$this->model->isAttributeReadOnly($attribute) || $includeReadOnly) && $this->model->getRelationModelClassName($attribute) == 'User') {
$attributeIsRequired = $this->model->isAttributeRequired($attribute);
if ($includeNonRequired && !$attributeIsRequired || $includeRequired && $attributeIsRequired) {
$attributes[$attribute . FormModelUtil::DELIMITER . self::DYNAMIC_ATTRIBUTE_USER] = array('label' => $this->model->getAttributeLabel($attribute));
}
}
if ($this->model->isRelation($attribute) && $this->model->isOwnedRelation($attribute) && $this->isRelationASingularRelation($attribute) && ($this->model->getRelationModelClassName($attribute) == 'Address' || $this->model->getRelationModelClassName($attribute) == 'Email')) {
$relatedModel = $this->model->{$attribute};
//Assumes only Email or Address are possible owned models here
$zurmoRules = WorkflowRules::makeByModuleClassName('ZurmoModule');
foreach ($relatedModel->getAttributes() as $relatedAttribute => $notUsed) {
if (!$relatedModel->isAttributeReadOnly($relatedAttribute) && !$relatedModel->isRelation($relatedAttribute) && $zurmoRules->attributeCanBeTriggered($relatedModel, $relatedAttribute)) {
$relatedAttributeIsRequired = $relatedModel->isAttributeRequired($relatedAttribute);
if ($includeNonRequired && !$relatedAttributeIsRequired || $includeRequired && $relatedAttributeIsRequired) {
$attributes[$attribute . FormModelUtil::RELATION_DELIMITER . $relatedAttribute] = array('label' => $this->model->getAttributeLabel($attribute) . ' ' . ComponentForWorkflowForm::DISPLAY_LABEL_RELATION_DIVIDER . ' ' . $relatedModel->getAttributeLabel($relatedAttribute));
}
}
}
}
}
return $attributes;
}