本文整理汇总了PHP中Model::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Model::get方法的具体用法?PHP Model::get怎么用?PHP Model::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Model
的用法示例。
在下文中一共展示了Model::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Get the value of the field of a loaded model. If model is not loaded
* will return default value instead.
*
* @return mixed current value of a field
*/
public function get()
{
if ($this->owner->loaded() || isset($this->owner->data[$this->short_name])) {
return $this->owner->get($this->short_name);
}
return $this->defaultValue();
}
示例2: __construct
/**
* Creates a new ModelField. The example below creates a ModelField which
* lists client accounts for selection.
*
* @code
* $clients = new ModelField("brokerage.setup.clients.client_id", "account");
* @endcode
* @param $path The full path to the field in the module which is to be returned by this field.
* @param $value The name of the field from the model whose value should be displayed in the list.
*/
public function __construct($path, $value)
{
global $redirectedPackage;
$this->info = Model::resolvePath($path);
$this->model = Model::load((substr($this->info["model"], 0, 1) == "." ? $redirectedPackage : "") . $this->info["model"]);
$this->valueField = $value;
$field = $this->model->getFields(array($value));
$this->setLabel($field[0]["label"]);
$this->setDescription($field[0]["description"]);
$this->setName($this->info["field"]);
$params = array("fields" => array($this->info["field"], $this->valueField), "sort_field" => $this->valueField);
if ($this->conditions != '') {
$params['conditions'] = $this->conditions;
}
$data = $this->model->get($params, Model::MODE_ARRAY);
$this->addOption("Add new " . Utils::singular($this->model->getEntity()), 'NEW');
foreach ($data as $datum) {
if ($datum[1] == "") {
$this->addOption($datum[0]);
} else {
$this->addOption($datum[1], $datum[0]);
}
}
$modelPath = str_replace('.', '/', $this->model->package);
$this->addAttribute('onchange', "fapiAddModelItem('{$modelPath}', this, '{$value}')");
}
示例3: remover
public static function remover(Model $imagem)
{
if ($imagem->get("id_imagem")) {
$sql = "delete from imagem where id_imagem = :id_imagem";
}
return self::exec($sql, $imagem);
}
示例4: remover
public static function remover(Model $origem_cliente)
{
if ($origem_cliente->get("id")) {
$sql = "delete from origem_cliente where id = :id";
}
return self::exec($sql, $origem_cliente);
}
示例5: removerTodosPorGaleria
public static function removerTodosPorGaleria(Model $galeria_item)
{
if ($galeria_item->get('id_galeria')) {
$sql = "delete from galeria_item where id_galeria = :id_galeria";
}
return self::exec($sql, $galeria_item);
}
示例6: remover
public static function remover(Model $produto)
{
if ($produto->get("id")) {
$sql = "delete from produto where id = :id";
}
return self::exec($sql, $produto);
}
示例7: remover
public static function remover(Model $modalidade)
{
if ($modalidade->get("id")) {
$sql = "delete from modalidade where id = :id";
}
return self::exec($sql, $modalidade);
}
示例8: remover
public static function remover(Model $status_visita)
{
if ($status_visita->get("id")) {
$sql = "delete from status_visita_orientacao where id = :id";
}
return self::exec($sql, $status_visita);
}
示例9: remover
public static function remover(Model $motivo_nao_orientacao)
{
if ($motivo_nao_orientacao->get("id")) {
$sql = "delete from motivo_nao_orientacao where id = :id";
}
return self::exec($sql, $motivo_nao_orientacao);
}
示例10: remover
public static function remover(Model $centro_custo)
{
if ($centro_custo->get("id")) {
$sql = "delete from centro_custo where id = :id";
}
return self::exec($sql, $centro_custo);
}
示例11: remover
public static function remover(Model $log)
{
if ($log->get("id")) {
$sql = "delete from log where id = :id";
}
return self::exec($sql, $log);
}
示例12: remover
public static function remover(Model $uf)
{
if ($uf->get("id")) {
$sql = "delete from uf where id = :id";
}
return self::exec($sql, $uf);
}
示例13: consultarPorCodigo
public static function consultarPorCodigo(Model $agencia_producao)
{
if ($agencia_producao->get('codigo')) {
$sql = "select ap.id,\n ap.nome,\n ap.codigo,\n u.id as id_uf,\n u.nome as uf\n from agencia_producao ap\n inner join uf u\n on ap.id_uf = u.id\n where codigo = :codigo\n and ativo = :ativo";
return self::query($sql, $agencia_producao);
}
}
示例14: remover
public static function remover(Model $tipo_aval)
{
if ($tipo_aval->get("id")) {
$sql = "delete from tipo_aval where id = :id";
}
return self::exec($sql, $tipo_aval);
}
示例15: remover
public static function remover(Model $video_youtube)
{
if ($video_youtube->get("id_youtube")) {
$sql = "delete from youtube where id_youtube = :id_youtube";
}
return self::exec($sql, $video_youtube);
}