本文整理汇总了PHP中Ak::pick方法的典型用法代码示例。如果您正苦于以下问题:PHP Ak::pick方法的具体用法?PHP Ak::pick怎么用?PHP Ak::pick使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ak
的用法示例。
在下文中一共展示了Ak::pick方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addOrEditRole
function _addOrEditRole($action)
{
$this->role->setAttributes(Ak::pick('name,description,is_enabled', $this->params['role']));
if ($this->role->save()){
$this->flash_options = array('seconds_to_close' => 10);
$this->flash['notice'] = $this->t('Role was successfully '.($action=='add'?'created':'updated'.'.'));
$this->redirectToAction('listing');
}
}
示例2: test_should_find_using_named_bindings
public function test_should_find_using_named_bindings()
{
$this->installAndIncludeModels(array('Hybrid' => 'id,customer_id,input,parent_id'));
$Hybrid = new Hybrid();
$customer_id = 12;
$input = 'abc';
$parent_id = 123;
$Hybrid->create(array('customer_id' => $customer_id, 'input' => $input, 'parent_id' => $parent_id));
$results = $Hybrid->find('all', array('conditions' => array('customer_id = :customer_id AND input = :input AND parent_id = :parent_id', ':customer_id' => $customer_id, ':input' => $input, ':parent_id' => $parent_id)));
$this->assertEqual(Ak::pick('customer_id,input,parent_id', $results[0]->getAttributes()), array('customer_id' => $customer_id, 'input' => $input, 'parent_id' => $parent_id));
}
示例3: test_should_set_and_get_attributes
public function test_should_set_and_get_attributes()
{
$this->WebPage->title = 'Akelos.org';
$this->WebPage->body = 'Akelos PHP framework...';
$this->WebPage->keywords = array('one', 'two');
$this->assertNull($this->WebPage->getId());
$this->assertTrue($this->WebPage->isNewRecord());
$this->WebPage->save();
$this->assertFalse($this->WebPage->isNewRecord());
$this->assertEqual($this->WebPage->title, 'Akelos.org');
$this->assertEqual(Ak::pick('body', $this->WebPage->getAttributes()), array('body' => 'Akelos PHP framework...'));
$this->assertEqual($this->WebPage->getAttribute('body'), 'Akelos PHP framework...');
$this->assertNotNull($this->WebPage->getId());
}
示例4: mapHasManyAssociations
private function mapHasManyAssociations($Resource, $associations, $options)
{
if (is_array($associations)) {
foreach ($associations as $k => $v) {
if (is_int($k)) {
$this->mapHasManyAssociations($Resource, $v, $options);
} else {
$this->mapHasManyAssociations($Resource, $k, array_merge($options, array('has_many' => $v)));
}
}
} else {
$options = array_merge(array('path_prefix' => $Resource->getNestingPathPrefix(), 'name_prefix' => $Resource->getNestingNamePrefix(), 'has_many' => isset($options['has_many']) ? $options['has_many'] : null), Ak::pick($this->_inheritable_options, $options));
$this->resources($associations, $options);
}
}
示例5: test_should_pick_parameters
public function test_should_pick_parameters()
{
$params = array('id' => 3, 'is_enabled' => 1, 'name' => 'Alicia');
$this->assertEqual(Ak::pick('id,name', $params), array('id' => 3, 'name' => 'Alicia'));
}