本文整理汇总了PHP中Jelly::id方法的典型用法代码示例。如果您正苦于以下问题:PHP Jelly::id方法的具体用法?PHP Jelly::id怎么用?PHP Jelly::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jelly
的用法示例。
在下文中一共展示了Jelly::id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
/**
* Implementation of Jelly_Field_Behavior_Saveable
*
* @param Jelly $model
* @param mixed $value
* @return void
*/
public function save($model, $value, $loaded)
{
// Empty relations to the default value
Jelly::update($this->foreign['model'])->where($this->foreign['column'], '=', $model->id())->set(array($this->foreign['column'] => $this->default))->execute();
// Set the new relations
if (!empty($value)) {
// Update the ones in our list
Jelly::update($this->foreign['model'])->where(':primary_key', '=', $value)->set(array($this->foreign['column'] => $model->id()))->execute();
}
}
示例2: _in
/**
* Returns either an array or unexecuted query to find
* which columns the model is "in" in the join table
*
* @param Jelly $model
* @param boolean $as_array
* @return mixed
*/
protected function _in($model, $as_array = FALSE)
{
$result = Jelly::select($this->through['model'])->select($this->through['columns'][1])->where($this->through['columns'][0], '=', $model->id());
if ($as_array) {
$result = $result->execute(Jelly::meta($model)->db())->as_array(NULL, $this->through['columns'][1]);
}
return $result;
}
示例3: has
/**
* Implementation of Jelly_Field_Behavior_Haveable
*
* @param Jelly $model
* @param array $ids
* @return void
*/
public function has($model, $ids)
{
return (bool) Jelly::select($this->foreign['model'])->where($this->foreign['column'], '=', $model->id())->where(':primary_key', 'IN', $ids)->count();
}