本文整理汇总了PHP中CustomFields::save方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomFields::save方法的具体用法?PHP CustomFields::save怎么用?PHP CustomFields::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomFields
的用法示例。
在下文中一共展示了CustomFields::save方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveCustomField
/**
* Save CustomFields
* @param CustomFields $customFields
* @returns boolean
* @throws DaoException, DataDuplicationException
*/
public function saveCustomField(CustomFields $customFields)
{
try {
$q = Doctrine_Query::create()->from('CustomFields c')->where('c.name = ?', $customFields->name)->andWhere('c.field_num <> ?', $customFields->field_num);
$freeNum = null;
if (empty($customFields->field_num)) {
$q = Doctrine_Query::create()->select('c.field_num')->from('CustomFields c')->orderBy('field_num');
$fieldNumbers = $q->execute(array(), Doctrine::HYDRATE_SCALAR);
$count = count($fieldNumbers);
$i = 1;
foreach ($fieldNumbers as $num) {
if ($num['c_field_num'] > $i) {
$freeNum = $i;
break;
}
$i++;
if ($i > 10) {
break;
}
}
if (empty($freeNum) && $i <= 10) {
$freeNum = $i;
}
$customFields->field_num = $freeNum;
}
if (!empty($customFields->field_num)) {
$customFields->save();
}
return $customFields;
// return true;
} catch (Doctrine_Exception $e) {
throw new DaoException($e->getMessage());
}
}
示例2: _install
public function _install()
{
$this->db->where('name', 'digital_products')->update('components', array('autoload' => '1', 'enabled' => '1'));
$field = new CustomFields();
$field->setEntity('Product')->setIsActive(true)->setname('dplink')->setfLabel('Link to digital content')->settypeId(3);
$field->save();
ShopCore::app()->SSettings->set('DPLinkCFID', $field->getId());
/** We recomend to use http://ellislab.com/codeigniter/user-guide/database/forge.html */
/**
$this->load->dbforge();
$fields = array(
'id' => array('type' => 'INT', 'constraint' => 11, 'auto_increment' => TRUE,),
'name' => array('type' => 'VARCHAR', 'constraint' => 50,),
'value' => array('type' => 'VARCHAR', 'constraint' => 100,)
);
$this->dbforge->add_key('id', TRUE);
$this->dbforge->add_field($fields);
$this->dbforge->create_table('mod_empty', TRUE);
*/
/**
*/
}