Salt-Stack需要声明(Salt-Stack require statement)
我开始玩Salt了。 我找不到任何关于如何使状态依赖于多个其他状态的信息。
state_a: module.run: - name: my.module - m_name: name_a state_b: module.run: - name: my.module - m_name: name_b state_c: module.run: - name: my.module - m_name: name_c - require: - module: ...
我怎样才能让
state_c
同时require
state_a
和state_b
?额外问题 :使用
Key: Single Value
结构在Salt中定义依赖关系的原因是什么?I've started playing with Salt. I could not find any info on how to make a state depend on multiple other states.
state_a: module.run: - name: my.module - m_name: name_a state_b: module.run: - name: my.module - m_name: name_b state_c: module.run: - name: my.module - m_name: name_c - require: - module: ...
How can I make
state_c
torequire
bothstate_a
andstate_b
?Bonus question: What is the rationale behind using
Key: Single Value
structure for defining dependencies in Salt?
原文:https://stackoverflow.com/questions/30842588
最满意答案
您是否尝试过直接在您的关联中定义订单? 我从来没有需要这样做,所以我不能发誓它会做你以后的事情,但是:
class City extends AppModel { $belongsTo = array( 'Country' => array( 'Order' => 'Country.name' ) ); }
当然,你可以为你的
Country
模式做类似的事情。Have you tried defining the order directly in your association? I've never needed to do this, so I can't swear it will do what you're after, but:
class City extends AppModel { $belongsTo = array( 'Country' => array( 'Order' => 'Country.name' ) ); }
You could do something similar for your
Country
model, of course.
相关问答
更多-
蛋糕的神奇作品......有条件...... 你认为可能是正确的,因为模型关系设置正确,它应该......工作。 但是您缺少一部分:将列表传递给视图。 那部分并不神奇。 阅读这部分文档 (在inputs开始之前几乎一直向下) 如果要在使用belongsTo - 或hasOne - Relation时创建选择字段,可以添加以下[...] (现在把你应该放的东西......) $this->set('staffs', $this->Pending->Staff->find('list')); 备注:注意变量名 ...
-
Cakephp属于订单(Cakephp belongsto with order)[2023-06-20]
我在CakePHP文档中找到了一个simliar问题的解决方案: http://book.cakephp.org/2.0/en/models/virtual-fields.html#virtual-fields-and-model-aliases 所以基本上,只要你想使用模型别名,最好在构造函数中定义这样的值: public function __construct($id = false, $table = null, $ds = null) { parent::__construct($ ... -
这个怎么样? class UserRelationship { var $belongsTo = array( 'User' => array( 'className' => 'User', 'foreignKey' => 'user_id' ), 'Friend' => array( 'className' => 'User', 'foreignKey' ...
-
如果你想随时随地使用,就像这样使用 对于cakephp 3.x $this->Virtualwarehouse->belongsTo('User',[ 'foreignKey' => 'winner', 'joinType' => 'INNER' ]); $winners = $this->Virtualwarehouse->find('all', [ 'contain'=>['User'] ]); $this-> ...
-
通过CakePHP中的belongsTo表指定顺序参数(Specifying order parameter through a belongsTo table in CakePHP)[2021-09-20]
您是否尝试过直接在您的关联中定义订单? 我从来没有需要这样做,所以我不能发誓它会做你以后的事情,但是: class City extends AppModel { $belongsTo = array( 'Country' => array( 'Order' => 'Country.name' ) ); } 当然,你可以为你的Country模式做类似的事情。 Have you tried defining the order dir ... -
CakePHP:无法从表单传递belongsTo对象的参数(CakePHP: Can't pass the parameters of a belongsTo object from a form)[2022-01-06]
与此同时,我可以让它发挥作用。 它真的只有几个字符..我复制结果,也许有人可以在以后使用它。 模型: public $filterArgs = array( 'username' => array('type' => 'like', 'field' => 'User.name'), 'status' => array('type' => 'like'), ... ); 视图: echo $this->Form->input('username', array('type' => 'text', ... -
我设法解决了这个问题。 简而言之,模型模型链接不是单向的,因为CakePHP文档称之为。 例如,如果模型A belongsTo模型B,则模型B必须hasOne或具有多个模型A. 就我而言,接收端的语法错误。 I managed to fix this issue. Simply put, model-model links are not a one-way street as the CakePHP documentation calls it. For example if model A belong ...
-
CakePHP不止一个属于(CakePHP more than one belongsTo)[2022-05-19]
尝试这个 var $belongsTo = array('Client','Doctor'); 它被称为数组。 更多关于文档中的数组 try this var $belongsTo = array('Client','Doctor'); it's called array. more about arrays in documentation -
实际上我认为这是幻灯片和资产之间的一对多关系。 从Model association页面 : belongsTo:当前模型包含外键。 因此,任何具有另一个外键的模型都属于另一个。 所以我看待它的方式: 项目: hasMany幻灯片 滑动: belongsTo Item(with item_id) belongsTo Asset(with asset_id) 资产: hasMany幻灯片 为了检索您想要的关联模型,我建议查看Containable行为 。 Actually I think this is a ...
-
如果您设置表格以正确反映它们之间的关系,CakePHP确实可以让您的生活更轻松。 您可以将代码减少90%,因为您不必尝试手动指定表的链接方式。 students --------------------------------------------- id | firstname | lastname | email graduate_applicants ------------------------------------ id | student_id | ...