本文整理汇总了PHP中ORM::ormFields方法的典型用法代码示例。如果您正苦于以下问题:PHP ORM::ormFields方法的具体用法?PHP ORM::ormFields怎么用?PHP ORM::ormFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ORM
的用法示例。
在下文中一共展示了ORM::ormFields方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadORM
public function loadORM(ORM $obj, $namespace = null)
{
$this->setElementsBelongTo(lcfirst($namespace));
$fields = $obj->ormFields();
foreach ($fields as $field) {
if ($obj->legacyORMNaming) {
$field = preg_replace_callback('/_(.)/', create_function('$matches', 'return strtoupper($matches[1]);'), $field);
}
if (!is_object($obj->{$field})) {
if (preg_match('/^date.*/', $field)) {
$element = $this->createElement('dateText', $field, array('label' => $this->_prettyName($field)));
} elseif (preg_match('/.*_id$/', $field)) {
$element = $this->createElement('hidden', $field, array('label' => $this->_prettyName($field)));
} else {
$element = $this->createElement('text', $field, array('label' => $this->_prettyName($field)));
}
$element->setValue($obj->{$field});
$this->addElement($element);
} elseif ($obj->{$field} instanceof ORM) {
$sf = new WebVista_Form();
$this->addSubForm($sf, "form" . ucwords($field));
$sf->loadORM($obj->{$field}, $namespace . '[' . lcfirst($field) . ']');
}
}
}
示例2: loadORM
public function loadORM(ORM $obj, $namespace = null)
{
$this->setElementsBelongTo(lcfirst($namespace));
$fields = $obj->ormFields();
foreach ($fields as $field) {
if (!is_object($obj->{$field})) {
if (preg_match('/^date.*/', $field)) {
$element = new Zend_Dojo_Form_Element_DateTextBox($field);
$element->setLabel($this->_prettyName($field));
} elseif (preg_match('/.*_id$/', $field)) {
$element = $this->createElement('hidden', $field, array('label' => $this->_prettyName($field)));
} else {
$element = $this->createElement('text', $field, array('label' => $this->_prettyName($field)));
}
$element->setValue($obj->{$field});
$this->addElement($element);
} elseif ($obj->{$field} instanceof ORM) {
$sf = new WebVista_Form();
$this->addSubForm($sf, "form" . ucwords($field));
$sf->loadORM($obj->{$field}, $namespace . '[' . lcfirst($field) . ']');
}
}
}
示例3: _setORMPersistMode
protected function _setORMPersistMode(ORM $orm, $cascadePersist = false)
{
$fields = $orm->ormFields();
foreach ($fields as $value) {
if ($orm->{$value} instanceof ORM) {
$orm->{$value}->_cascadePersist = $cascadePersist;
$this->_setORMPersistMode($orm->{$value}, $cascadePersist);
}
}
}