当前位置: 首页>>代码示例>>PHP>>正文


PHP JModelLegacy::getName方法代码示例

本文整理汇总了PHP中JModelLegacy::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP JModelLegacy::getName方法的具体用法?PHP JModelLegacy::getName怎么用?PHP JModelLegacy::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JModelLegacy的用法示例。


在下文中一共展示了JModelLegacy::getName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: postSaveHook

 /**
  * Update the ordered items in post save hook
  */
 protected function postSaveHook(JModelLegacy $model, $validData = array())
 {
     $order_id = $model->getState($model->getName() . '.id');
     $data = JFactory::getApplication()->input->post->getArray(array('jform' => array('ordered' => 'array', 'deleted' => 'array')));
     // We add order items right on order edit view
     foreach ($data['jform']['ordered'] as $item) {
         $item['order_id'] = $order_id;
         $model = JModelLegacy::getInstance('OrderItem', 'DZProductModel');
         $form = $model->getForm($item, false);
         if (!$form) {
             continue;
         }
         $validItem = $model->validate($form, $item);
         if ($validItem === false) {
             continue;
         }
         if (!$model->save($validItem)) {
             continue;
         }
     }
     // Make sure the submitted deleted ids are all integer
     JArrayHelper::toInteger($data['jform']['deleted']);
     // Remove items
     $model = JModelLegacy::getInstance('OrderItem', 'DZProductModel');
     $model->delete($data['jform']['deleted']);
 }
开发者ID:nadsrosun,项目名称:ProductComparisonDemo,代码行数:29,代码来源:order.php

示例2: testGetName

 /**
  * Tests the getName method.
  *
  * @expectedException      Exception
  * @expectedExceptionCode  500
  *
  * @since   12.3
  *
  * @return  void
  */
 public function testGetName()
 {
     // Test default fixture
     $this->assertEquals('lead', $this->fixture->getName());
     $this->assertEquals('com_test', TestReflection::getValue($this->fixture, 'option'));
     // Test creating fixture with model in class name
     $this->fixture = JModelLegacy::getInstance('Room', 'RemodelModel');
     $this->assertEquals('room', $this->fixture->getName());
     $this->assertEquals('com_remodel', TestReflection::getValue($this->fixture, 'option'));
     // Ensure that $name can be set properly, and doesn't change $option
     TestReflection::setValue($this->fixture, 'name', 'foo');
     $this->assertEquals('foo', $this->fixture->getName());
     $this->assertEquals('com_remodel', TestReflection::getValue($this->fixture, 'option'));
     // Test creating a non-existant class.
     $this->assertFalse(JModelLegacy::getInstance('Does', 'NotExist'));
     // Test creating class that does exist, but does not contain 'Model' (uppercase)
     $this->fixture = JModelLegacy::getInstance('NomodelInName');
     $this->fixture->getName();
 }
开发者ID:ZerGabriel,项目名称:joomla-platform,代码行数:29,代码来源:JModelLegacyTest.php

示例3: setModel

 /**
  * Method to add a model to the view.  We support a multiple model single
  * view system by which models are referenced by classname.  A caveat to the
  * classname referencing is that any classname prepended by JModel will be
  * referenced by the name without JModel, eg. JModelCategory is just
  * Category.
  *
  * @param   JModelLegacy  $model    The model to add to the view.
  * @param   boolean       $default  Is this the default model?
  *
  * @return  object   The added model.
  *
  * @since   12.2
  */
 public function setModel($model, $default = false)
 {
     $name = strtolower($model->getName());
     $this->_models[$name] = $model;
     if ($default) {
         $this->_defaultModel = $name;
     }
     return $model;
 }
开发者ID:jsanchezgr,项目名称:joomla-cms,代码行数:23,代码来源:legacy.php

示例4: setModel

 /**
  * Method to add a model to the create object.
  *
  * @param   JModelLegacy  $model    The model to add.
  *
  * @return  object   The added model.
  */
 protected function setModel($model)
 {
     $name = strtolower($model->getName());
     $this->_models[$name] = $model;
     return $this->_models[$name];
 }
开发者ID:joshjim27,项目名称:jobsglobal,代码行数:13,代码来源:create.php

示例5: testNameOfExistingClassThatDoesNotContainModel

 /**
  * Test getting the name of a class that does exist, but does not contain 'Model' (upper- or lowercase)
  *
  * @expectedException      Exception
  * @expectedExceptionCode  500
  *
  * @since   12.3
  *
  * @return  void
  *
  * @testdox getName() throws exception if class has no 'model' in classname
  */
 public function testNameOfExistingClassThatDoesNotContainModel()
 {
     $this->fixture = new NokeywordInName();
     $this->fixture->getName();
 }
开发者ID:SysBind,项目名称:joomla-cms,代码行数:17,代码来源:JModelLegacyTest.php


注:本文中的JModelLegacy::getName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。