本文整理汇总了PHP中MUtil_Model_ModelAbstract::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP MUtil_Model_ModelAbstract::getName方法的具体用法?PHP MUtil_Model_ModelAbstract::getName怎么用?PHP MUtil_Model_ModelAbstract::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MUtil_Model_ModelAbstract
的用法示例。
在下文中一共展示了MUtil_Model_ModelAbstract::getName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Construct the bridge while setting the model.
*
* Extra parameters can be added in subclasses, but the first parameter
* must remain the model.
*
* @param \MUtil_Model_ModelAbstract $model
* @param \Zend_Form $form Rquired
*/
public function __construct(\MUtil_Model_ModelAbstract $model, \Zend_Form $form = null)
{
$this->model = $model;
$this->form = $form;
if (!$form instanceof \Zend_Form) {
throw new \MUtil_Model_ModelException("No form specified while create a form bridge for model " . $model->getName());
}
if (!$form->getName()) {
$form->setName($model->getName());
}
}
示例2: addModel
/**
* Add an (extra) model to the join
*
* @param \MUtil_Model_ModelAbstract $subModel
* @param array $joinFields
* @return \MUtil_Model_Transform_NestedTransformer (continuation pattern)
*/
public function addModel(\MUtil_Model_ModelAbstract $subModel, array $joinFields)
{
// \MUtil_Model::$verbose = true;
$name = $subModel->getName();
$this->_subModels[$name] = $subModel;
$this->_joins[$name] = $joinFields;
return $this;
}
示例3: _checkName
/**
* Checks name for being a key id field and in that case returns the real field name
*
* @param string $name The field name or key name
* @param boolean $throwError By default we throw an error until rendering
* @return string The real name and not e.g. the key id
* @throws \MUtil_Model_ModelException
*/
protected function _checkName($name, $throwError = true)
{
if ($this->model->has($name)) {
return $name;
}
$modelKeys = $this->model->getKeys();
if (isset($modelKeys[$name])) {
return $modelKeys[$name];
}
if ($throwError) {
throw new \MUtil_Model_ModelException(sprintf('Request for unknown item %s from model %s.', $name, $this->model->getName()));
}
return $name;
}
示例4: addUnionModel
/**
* Add an extra model to the union
*
* @param \MUtil_Model_ModelAbstract $model
* @param array $fieldMap Map from the sub model field names to this models names
* @param string $name
* @return \MUtil_Model_UnionModelAbstract (continuation pattern)
*/
public function addUnionModel(\MUtil_Model_ModelAbstract $model, array $fieldMap = null, $name = null)
{
if (null === $name) {
$name = $model->getName();
}
$this->_unionModels[$name] = $model;
if ($fieldMap) {
$this->_unionMapsFrom[$name] = $fieldMap;
$this->_unionMapsTo[$name] = array_flip($fieldMap);
} else {
$this->_unionMapsFrom[$name] = false;
$this->_unionMapsTo[$name] = false;
$fieldMap = array();
}
foreach ($model->getItemsOrdered() as $subName) {
if (isset($fieldMap[$subName])) {
$mainName = $fieldMap[$subName];
} else {
$mainName = $subName;
}
$this->set($mainName, $model->get($subName));
}
return $this;
}
示例5: addModel
/**
* Add a 'submodel' field to the model.
*
* You get a nested join where a set of rows is placed in the $name field
* of each row of the parent model.
*
* @param \MUtil_Model_ModelAbstract $model
* @param array $joins The join fields for the sub model
* @param string $name Optional 'field' name, otherwise model name is used
* @return \MUtil_Model_Transform_NestedTransformer The added transformer
*/
public function addModel(\MUtil_Model_ModelAbstract $model, array $joins, $name = null)
{
if (null === $name) {
$name = $model->getName();
}
$trans = new \MUtil_Model_Transform_NestedTransformer();
$trans->addModel($model, $joins);
$this->addTransformer($trans);
$this->set($name, 'model', $model, 'elementClass', 'FormTable', 'type', \MUtil_Model::TYPE_CHILD_MODEL);
return $trans;
}
示例6: getImportOnlyBatch
/**
*
* @param \MUtil_Task_TaskBatch $batch Optional batch with different source etc..
* @return \MUtil_Task_TaskBatch
*/
public function getImportOnlyBatch(\MUtil_Task_TaskBatch $batch = null)
{
if (!$this->_importBatch instanceof \MUtil_Task_TaskBatch) {
$batch = new \MUtil_Task_TaskBatch(__CLASS__ . '_import_' . basename($this->sourceModel->getName()) . '_' . __FUNCTION__);
$this->registrySource->applySource($batch);
$batch->setSource($this->registrySource);
$batch->setVariable('targetModel', $this->getTargetModel());
$this->_importBatch = $batch;
} else {
$batch = $this->_importBatch;
}
$this->_importBatch->getStack()->registerAllowedClass('MUtil_Date');
// \MUtil_Echo::track($this->_importBatch->count());
if (!$batch->isLoaded()) {
if ($this->_filename) {
$batch->addTask('AddTask', 'File_CopyFileWhenTask', $this->_filename, $this->getSuccessDirectory() . DIRECTORY_SEPARATOR . $this->getLongtermFilename() . '.' . $this->_extension, 'import_errors', 0, 0);
}
// Rest of loading is done by getCheckOnlyBatch, but when started, the above task must be added.
}
return $this->_importBatch;
}