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


PHP SS_List::dataclass方法代码示例

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


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

示例1: getManipulatedData

 public function getManipulatedData(GridField $gridField, SS_List $dataList)
 {
     if (!$gridField->State->GridFieldAddRelation) {
         return $dataList;
     }
     $objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
     if ($objectID) {
         $object = DataObject::get_by_id($dataList->dataclass(), $objectID);
         if ($object) {
             $dataList->add($object);
         }
     }
     $gridField->State->GridFieldAddRelation = null;
     return $dataList;
 }
开发者ID:helpfulrobot,项目名称:jonshutt-find-many-many-dropdown,代码行数:15,代码来源:FindManyManyDropdown.php

示例2: getManipulatedData

 /**
  * If an object ID is set, add the object to the list
  *
  * @param GridField $gridField
  * @param SS_List $dataList
  * @return SS_List
  */
 public function getManipulatedData(GridField $gridField, SS_List $dataList)
 {
     if (!$gridField->State->GridFieldAddRelation) {
         return $dataList;
     }
     $objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
     if ($objectID) {
         $object = DataObject::get_by_id($dataList->dataclass(), $objectID);
         if ($object) {
             $virtual = new ElementVirtualLinked();
             $virtual->LinkedElementID = $object->ID;
             $virtual->write();
             $dataList->add($virtual);
         }
     }
     $gridField->State->GridFieldAddRelation = null;
     return $dataList;
 }
开发者ID:nyeholt,项目名称:silverstripe-elemental,代码行数:25,代码来源:ElementalGridFieldAddExistingAutocompleter.php

示例3: getManipulatedData

 /**
  * If an object ID is set, add the object to the list
  *
  * @param GridField $gridField
  * @param SS_List $dataList
  * @return SS_List
  */
 public function getManipulatedData(GridField $gridField, SS_List $dataList)
 {
     if (!$gridField->State->GridFieldAddRelation) {
         return $dataList;
     }
     $objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
     if ($objectID) {
         $object = DataObject::get_by_id($dataList->dataclass(), $objectID);
         if ($object) {
             if ($this->_item_limit > 0 && $dataList->count() + 1 > $this->_item_limit) {
                 $gridField->getForm()->getController()->getResponse()->addHeader('X-Status', _t('LimitedRelationsGridField.ITEM_LIMIT_REACHED', '_You cannot add any more items, you can only add {count} items. Please remove one then try again.', array('count' => $this->_item_limit)));
             } else {
                 $dataList->add($object);
             }
         }
     }
     $gridField->State->GridFieldAddRelation = null;
     return $dataList;
 }
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-limitedrelationsgridfield,代码行数:26,代码来源:LRGridFieldAddExistingAutocompleter.php

示例4: getManipulatedData

 /**
  * If an object ID is set, add the object to the list
  *
  * @param GridField $gridField
  * @param SS_List $dataList
  * @return SS_List
  */
 public function getManipulatedData(GridField $gridField, SS_List $dataList)
 {
     if (!$gridField->State->GridFieldAddRelation) {
         return $dataList;
     }
     $objectID = Convert::raw2sql($gridField->State->GridFieldAddRelation);
     if ($objectID) {
         $object = DataObject::get_by_id($dataList->dataclass(), $objectID);
         if ($object) {
             // if the object is currently not linked to either a page or another list then we want to link to
             // the original, otherwise link to a clone
             if (!$object->ParentID && !$object->ListID) {
                 $dataList->add($object);
             } else {
                 $virtual = new ElementVirtualLinked();
                 $virtual->LinkedElementID = $object->ID;
                 $virtual->write();
                 $dataList->add($virtual);
             }
         }
     }
     $gridField->State->GridFieldAddRelation = null;
     return $dataList;
 }
开发者ID:dnadesign,项目名称:silverstripe-elemental,代码行数:31,代码来源:ElementalGridFieldAddExistingAutocompleter.php

示例5: subtract

 /**
  * This method returns a copy of this list that does not contain any DataObjects that exists in $list
  *
  * The $list passed needs to contain the same dataclass as $this
  *
  * @param SS_List $list
  * @return DataList
  * @throws BadMethodCallException
  */
 public function subtract(SS_List $list)
 {
     if ($this->dataclass() != $list->dataclass()) {
         throw new InvalidArgumentException('The list passed must have the same dataclass as this class');
     }
     return $this->alterDataQuery(function ($query) use($list) {
         $query->subtract($list->dataQuery());
     });
 }
开发者ID:assertchris,项目名称:silverstripe-framework,代码行数:18,代码来源:DataList.php

示例6: subtract

 /**
  * This method returns a list does not contain any DataObjects that exists in $list
  * 
  * It does not return the resulting list, it only adds the constraints on the database to exclude
  * objects from $list.
  * The $list passed needs to contain the same dataclass as $this
  *
  * @param SS_List $list
  * @return DataList 
  * @throws BadMethodCallException
  */
 public function subtract(SS_List $list)
 {
     if ($this->dataclass() != $list->dataclass()) {
         throw new InvalidArgumentException('The list passed must have the same dataclass as this class');
     }
     $newlist = clone $this;
     $newlist->dataQuery->subtract($list->dataQuery());
     return $newlist;
 }
开发者ID:nomidi,项目名称:sapphire,代码行数:20,代码来源:DataList.php

示例7: getManipulatedData

 /**
  * If an object ID is set, add the object to the list
  *
  * @param GridField $gridField
  * @param SS_List $dataList
  * @return SS_List
  */
 public function getManipulatedData(GridField $gridField, SS_List $dataList)
 {
     $objectID = $gridField->State->GridFieldAddRelation(null);
     if (empty($objectID)) {
         return $dataList;
     }
     $object = DataObject::get_by_id($dataList->dataclass(), $objectID);
     if ($object) {
         $dataList->add($object);
     }
     $gridField->State->GridFieldAddRelation = null;
     return $dataList;
 }
开发者ID:ivoba,项目名称:silverstripe-framework,代码行数:20,代码来源:GridFieldAddExistingAutocompleter.php


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