本文整理汇总了PHP中ky_assure_object函数的典型用法代码示例。如果您正苦于以下问题:PHP ky_assure_object函数的具体用法?PHP ky_assure_object怎么用?PHP ky_assure_object使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ky_assure_object函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setSelectedOptions
/**
* Sets selected options of this custom field.
*
* @param kyCustomFieldOption[] $options List of options.
* @return kyCustomFieldMultiSelect
*/
public function setSelectedOptions($options)
{
//make sure it's array
if (!is_array($options)) {
if ($options === null) {
$options = array();
} else {
$options = array($options);
}
}
//check for proper class and eliminate duplicates
$options_ids = array();
$this->options = array();
foreach ($options as $option) {
$option = ky_assure_object($option, 'kyCustomFieldOption');
if ($option !== null && !in_array($option->getId(), $options_ids)) {
$this->options[] = $option;
$options_ids[] = $option->getId();
}
}
//update raw value
$option_values = array();
foreach ($this->options as $field_option) {
$option_values[] = $field_option->getValue();
}
$this->raw_value = implode(self::VALUES_SEPARATOR, $option_values);
}
示例2: setSelectedOption
/**
* Sets the field selected option.
*
* @param kyCustomFieldOption $option Child (linked) field option.
* @return kyCustomFieldLinkedSelect
*/
public function setSelectedOption($option)
{
$this->option = ky_assure_object($option, 'kyCustomFieldOption');
if ($this->option !== null) {
$parent_option = $this->getOption($this->option->getParentOptionId());
$this->raw_value = implode(self::PARENT_CHILD_SEPARATOR, array($parent_option->getValue(), $this->option->getValue()));
} else {
$this->raw_value = null;
}
return $this;
}
示例3: setSelectedOption
/**
* Sets the field selected option.
*
* @param kyCustomFieldOption $option Field option.
* @return kyCustomFieldWithOptions
*/
public function setSelectedOption($option)
{
$this->option = ky_assure_object($option, 'kyCustomFieldOption');
$this->raw_value = $this->option !== null ? $this->option->getValue() : null;
return $this;
}
示例4: setOwnerStaff
/**
* Sets staff user, owner of this ticket.
*
* @param kyStaff $owner_staff Staff user.
* @return kyTicket
*/
public function setOwnerStaff($owner_staff)
{
$this->owner_staff = ky_assure_object($owner_staff, 'kyStaff');
$this->owner_staff_id = $this->owner_staff !== null ? $this->owner_staff->getId() : null;
return $this;
}
示例5: setStaffGroup
/**
* Sets staff group for the staff user.
*
* @param kyStaffGroup $staff_group Staff group object.
* @return kyStaff
*/
public function setStaffGroup($staff_group)
{
$this->staff_group = ky_assure_object($staff_group, 'kyStaffGroup');
$this->staff_group_id = $this->staff_group !== null ? $staff_group->getId() : null;
return $this;
}
示例6: setUserOrganization
/**
* Sets user organization assigned to the user.
*
* @param kyUserOrganization $user_organization User organization.
* @return kyUser
*/
public function setUserOrganization(kyUserOrganization $user_organization)
{
$this->user_organization = ky_assure_object($user_organization, 'kyUserOrganization');
$this->user_organization_id = $this->user_organization !== null ? $this->user_organization->getId() : null;
return $this;
}
示例7: setEditedStaff
/**
* Sets staff user, the editor of this news item update.
*
* @param kyStaff $staff Staff user.
* @return kyNewsItem
*/
public function setEditedStaff($staff)
{
$this->edited_staff = ky_assure_object($staff, 'kyStaff');
$this->edited_staff_id = $this->edited_staff !== null ? $this->edited_staff->getId() : null;
return $this;
}
示例8: setParentDepartment
/**
* Sets parent department for this department.
*
* @param kyDepartment $parent_department Department object that will be the parent for this department.
* @return kyDepartment
*/
public function setParentDepartment($parent_department)
{
$this->parent_department = ky_assure_object($parent_department, 'kyDepartment');
$this->parent_department_id = $this->parent_department !== null ? $this->parent_department->getId() : null;
return $this;
}
示例9: setParentComment
/**
* Sets the parent comment (comment that this comment is a reply to).
*
* @param kyCommentBase $parent_comment Parent comment (comment that this comment is a reply to).
* @return $this
*/
public function setParentComment($parent_comment)
{
$this->parent_comment = ky_assure_object($parent_comment, get_class($this));
$this->parent_comment_id = $this->parent_comment !== null ? $this->parent_comment->getId() : null;
return $this;
}
示例10: setStaff
/**
* Sets staff user, the creator of this knowledgebase article.
*
* @param kyStaff $staff Staff user.
* @return kyKnowledgebaseArticle
*/
public function setStaff($creator)
{
$this->creator = ky_assure_object($creator, 'kyStaff');
$this->creator_id = $this->creator !== null ? $this->creator->getId() : null;
return $this;
}
示例11: setStaff
/**
* Sets staff user, the creator of this post.
*
* @param kyStaff $staff Staff user.
* @return kyTicketPost
*/
public function setStaff($staff)
{
$this->staff = ky_assure_object($staff, 'kyStaff');
$this->staff_id = $this->staff !== null ? $this->staff->getId() : null;
$this->creator = $this->staff !== null ? self::CREATOR_STAFF : null;
$this->user_id = null;
$this->user = null;
return $this;
}
示例12: setCreatorStaff
/**
* Sets staff user that creates the time track.
*
* @param kyStaff $creator_staff Staff user that creates the time track.
* @return kyTicketTimeTrack
*/
public function setCreatorStaff($creator_staff)
{
$this->creator_staff = ky_assure_object($creator_staff, 'kyStaff');
$this->creator_staff_id = $this->creator_staff !== null ? $this->creator_staff->getId() : null;
$this->creator_staff_name = $this->creator_staff !== null ? $this->creator_staff->getFullName() : null;
return $this;
}
示例13: setTicketPost
/**
* Sets the ticket post this attachment will be attached to.
*
* Automatically sets the ticket.
*
* @param kyTicketPost $ticket_post Ticket post.
*/
public function setTicketPost($ticket_post)
{
$this->ticket_post = ky_assure_object($ticket_post, 'kyTicketPost');
$this->ticket_post_id = $this->ticket_post !== null ? $this->ticket_post->getId() : null;
$this->ticket = $this->ticket_post !== null ? $this->ticket_post->getTicket() : null;
$this->ticket_id = $this->ticket !== null ? $this->ticket->getId() : null;
}
示例14: setNewsItem
/**
* Sets news item.
*
* @param kyNewsItem $news_item News item.
* @return kyNewsComment
*/
public function setNewsItem($news_item)
{
$this->news_item = ky_assure_object($news_item, 'kyNewsItem');
$this->news_item_id = $this->news_item !== null ? $this->news_item->getId() : null;
return $this;
}
示例15: setKbarticle
/**
* Sets KnowledgebaseArticle.
*
* @param kyKnowledgebaseArticle $kbarticle kbarticle item.
* @return kyKnowledgebaseComment
*/
public function setKbarticle($kbarticle)
{
$this->kbarticle = ky_assure_object($kbarticle, 'kyKnowledgebaseArticle');
$this->kbarticle_id = $this->kbarticle !== null ? $this->kbarticle->getId() : null;
return $this;
}