English 中文(简体)
CakePHP - HABTM, 预先界定的模型
原标题:CakePHP - HABTM with predefined Model

I have two models: Bar HABTM Foo. Now I have bars_foos join table with some additional fields.

当我与一些oo协会或反之亦然加入新的律师协会时,我需要进行许多验证检查,无论是新协会还是新协会。 检查的依据是确定和已经节省的协会的额外领域。

我在哪里进行这些验证? In Bar/Foo Controller? 或者,我是否应当制定具有验证规则的BarsFoo模式?

当我保持HABTM关系,把所有汽车从卡纳克里带走时,我找不到一种办法告诉卡克人使用我自己预先界定的具有验证规则的BarsFoo模式。 面包车制造自己的虚拟模式,无视地雷。

或者,我(在这一具体情况下)是否将HABTM分解成“Many-belongsto-hasMany”关系,在那里,我可以使用我自己的BarsFoo模式?

最佳回答

您可以使用<代码>和的钥匙界定您的加入模式,并在其中确立你的确认:

public $hasAndBelongsToMany = array(
     Bar  => array(
        …
         with  =>  BarFoos 
    )
);

问题回答

暂无回答




相关问题
Bind Button.IsEnabled to custom validation with XAML?

I am sorry I didn t know how to title my question any better, you name it if you got a good 1. I have an entity Contact. this person has navigation properties: Address, Phones (A collection of Phone)....

WPF - MVVM - NHibernate Validation

Im facing a bit of an issue when trying to validate a decimal property on domain object which is bound to a textbox on the view through the viewmodel. I am using NHibernate to decorate my property on ...

Wpf Combobox Limit to List

We are using Wpf Combobox to allow the user to do the following things: 1) select items by typing in the first few characters 2) auto complete the entry by filtering the list 3) suggesting the first ...

Rails 101 | validates_currency?

I ve searched high and low, but I could not find a solution, to what I think seems like a very common task. In a form I want to have a text input that accepts currency strings (i.e. $1,000,000 or ...

CodeIgniter form verification and class

I m using the form validation library and have something like this in the view <p> <label for="NAME">Name <span class="required">*</span></label> <?...

热门标签