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


PHP Object_Abstract::getById方法代码示例

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


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

示例1: load

 /**
  * Loads a list of entries for the specicifies parameters, returns an array of Search_Backend_Data
  *
  * @return array
  */
 public function load()
 {
     $entries = array();
     $data = $this->db->fetchAll("SELECT * FROM search_backend_data" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($data as $entryData) {
         if ($entryData['maintype'] == 'document') {
             $element = Document::getById($entryData['id']);
         } else {
             if ($entryData['maintype'] == 'asset') {
                 $element = Asset::getById($entryData['id']);
             } else {
                 if ($entryData['maintype'] == 'object') {
                     $element = Object_Abstract::getById($entryData['id']);
                 } else {
                     Logger::err("unknown maintype ");
                 }
             }
         }
         if ($element) {
             $entry = new Search_Backend_Data();
             $entry->setId(new Search_Backend_Data_Id($element));
             $entry->setFullPath($entryData['fullpath']);
             $entry->setType($entryData['type']);
             $entry->setSubtype($entryData['subtype']);
             $entry->setUserOwner($entryData['userowner']);
             $entry->setUserModification($entryData['usermodification']);
             $entry->setCreationDate($entryData['creationdate']);
             $entry->setModificationDate($entryData['modificationdate']);
             $entry->setPublished($entryData['published'] === 0 ? false : true);
             $entries[] = $entry;
         }
     }
     $this->model->setEntries($entries);
     return $entries;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:40,代码来源:Resource.php

示例2: getIdPathForElement

 /**
  * @static
  * @param  $element
  * @return string
  */
 public static function getIdPathForElement($element)
 {
     $path = "";
     if ($element instanceof Document) {
         $nid = $element->getParentId();
         $ne = Document::getById($nid);
     } else {
         if ($element instanceof Asset) {
             $nid = $element->getParentId();
             $ne = Asset::getById($nid);
         } else {
             if ($element instanceof Object_Abstract) {
                 $nid = $element->getO_parentId();
                 $ne = Object_Abstract::getById($nid);
             }
         }
     }
     if ($ne) {
         $path = self::getIdPathForElement($ne, $path);
     }
     if ($element) {
         $path = $path . "/" . $element->getId();
     }
     return $path;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:30,代码来源:Tool.php

示例3: setAction

 public function setAction()
 {
     $owner = $_POST['user'];
     $activities = $_POST['activities'];
     $object = $_POST['object'];
     $isValid = Website_P1GlobalFunction::checkValidation($_POST, array('user', 'activities', 'object'));
     if (count($isValid) > 0) {
         $arrayReturn = array("status" => "failed", "message" => "field not found", "data" => $isValid);
         $json_plans = $this->_helper->json($arrayReturn);
         Website_P1GlobalFunction::sendResponse($json_plans);
         exit;
     }
     $ownerId = Object_Abstract::getById($owner);
     $activitiesId = Object_Abstract::getById($activities);
     $key = str_replace(' ', '_', strtolower($ownerId->Name)) . "-" . str_replace(' ', '_', strtolower($activitiesId->Name) . "-" . rand());
     $now = date("Y-m-d,H-i");
     $getDateTime = new Pimcore_Date($now);
     if ($ownerId->o_className == "Customer") {
         $getId = Object_Abstract::getByPath('/log/customers');
         //get folder id
         $setLog = new Object\LogCustomers();
         $setLog->setCustomers($ownerId);
         $setLog->setActivities($activitiesId);
         $setLog->setObjectContent($object);
         $setLog->setDatetime($getDateTime);
         $setLog->setO_parentId($getId->o_id);
         $setLog->setKey($key);
         $setLog->setPublished(1);
         $setLog->save();
         $status = "Success";
         $message = "Success";
         $data = "Add Customer log Success";
     } else {
         if ($ownerId->o_className == "Agen") {
             $getId = Object_Abstract::getByPath('/log/agen');
             //get folder id
             $setLog = new Object\LogAgents();
             $setLog->setAgen($ownerId);
             $setLog->setActivities($activitiesId);
             $setLog->setObjectContent($object);
             $setLog->setDatetime($getDateTime);
             $setLog->setO_parentId($getId->o_id);
             $setLog->setKey($key);
             $setLog->setPublished(1);
             $setLog->save();
             $status = "Success";
             $message = "Success";
             $data = "Add Agen log Success";
         } else {
             $status = "Field";
             $message = "Log id not found";
             $data = "Null";
         }
     }
     $arrayReturn = array("status" => $status, "message" => $message, "data" => $data);
     $json_log = $this->_helper->json($arrayReturn);
     Website_P1GlobalFunction::sendResponse($json_log);
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:58,代码来源:LogController.php

示例4: productDetailAction

 public function productDetailAction()
 {
     $key = $this->_getParam('text');
     $id = $this->_getParam('id');
     $entries = Object_Abstract::getById($id);
     $data = $entries;
     $this->view->product = $data;
     $this->enableLayout();
     $this->view->layout()->setLayout("layout_mobile");
 }
开发者ID:pawansgi92,项目名称:pimcore2,代码行数:10,代码来源:ProductController.php

示例5: previewAction

 /**
  * Preview entry in pimcore admin.
  *
  * @throws Zend_Controller_Action_Exception
  */
 public function previewAction()
 {
     $id = (int) $this->_getParam('o_id');
     $entry = Object_Abstract::getById($id);
     /* @var $entry Blog_Entry */
     if (null == $entry) {
         throw new Zend_Controller_Action_Exception("No entry with ID '{$id}'", 404);
     }
     return $this->_forward('show', null, null, array('key' => $entry->getUrlPath()));
 }
开发者ID:weblizards-gmbh,项目名称:blog,代码行数:15,代码来源:EntryController.php

示例6: load

 /**
  * Loads a list of objects for the specicifies parameters, returns an array of Object_Abstract elements
  *
  * @return array
  */
 public function load()
 {
     $objects = array();
     $objectsData = $this->db->fetchAll("SELECT o_id,o_type FROM objects" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($objectsData as $objectData) {
         // return all documents as Type Document => fot trees an so on there isn't the whole data required
         $objects[] = Object_Abstract::getById($objectData["o_id"]);
     }
     $this->model->setObjects($objects);
     return $objects;
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:16,代码来源:Resource.php

示例7: load

 /**
  * Loads a list of objects for the specicifies parameters, returns an array of Object_Abstract elements
  *
  * @return array
  */
 public function load()
 {
     $objects = array();
     $objectsData = $this->db->fetchAll("SELECT o_id,o_type FROM objects" . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     foreach ($objectsData as $objectData) {
         if ($object = Object_Abstract::getById($objectData["o_id"])) {
             $objects[] = $object;
         }
     }
     $this->model->setObjects($objects);
     return $objects;
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:17,代码来源:Resource.php

示例8: cleanUp

 /**
  * legacy - not required anymore
  *
  *
  * @return void
  */
 protected function cleanUp()
 {
     try {
         $class = Object_Class::getByName("unittest");
         if ($class instanceof Object_Class) {
             $class->delete();
         }
     } catch (Exception $e) {
     }
     try {
         $objectRoot = Object_Abstract::getById(1);
         if ($objectRoot and $objectRoot->hasChilds()) {
             $childs = $objectRoot->getChilds();
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     } catch (Exception $e) {
     }
     try {
         $assetRoot = Asset::getById(1);
         if ($assetRoot and $assetRoot->hasChilds()) {
             $childs = $assetRoot->getChilds();
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     } catch (Exception $e) {
     }
     try {
         $documentRoot = Asset::getById(1);
         if ($documentRoot and $documentRoot->hasChilds()) {
             $childs = $documentRoot->getChilds();
             foreach ($childs as $child) {
                 $child->delete();
             }
         }
     } catch (Exception $e) {
     }
     try {
         $userList = new User_List();
         $userList->setCondition("id > 1");
         $users = $userList->load();
         if (is_array($users) and count($users) > 0) {
             foreach ($users as $user) {
                 $user->delete();
             }
         }
     } catch (Exception $e) {
     }
 }
开发者ID:ngocanh,项目名称:pimcore,代码行数:57,代码来源:AllTests.php

示例9: load

 /**
  * Loads a list of objects for the specicifies parameters, returns an array of Object_Abstract elements
  *
  * @return array 
  */
 public function load()
 {
     $objects = array();
     try {
         $objectsData = $this->db->fetchAll("SELECT DISTINCT " . $this->getTableName() . ".o_id AS o_id,o_type FROM `" . $this->getTableName() . "`" . $this->getJoins() . $this->getCondition() . $this->getGroupBy() . $this->getOrder() . $this->getOffsetLimit(), $this->model->getConditionVariables());
     } catch (Exception $e) {
         return $this->exceptionHandler($e);
     }
     foreach ($objectsData as $objectData) {
         if ($object = Object_Abstract::getById($objectData["o_id"])) {
             $objects[] = Object_Abstract::getById($objectData["o_id"]);
         }
     }
     $this->model->setObjects($objects);
     return $objects;
 }
开发者ID:nblackman,项目名称:pimcore,代码行数:21,代码来源:Resource.php

示例10: exportAction

 public function exportAction()
 {
     try {
         $objectId = $this->getParam("objectId");
         $object = Object_Abstract::getById($objectId);
         $exportFile = PimPon_Object_Export::doExport($object);
         ob_end_clean();
         header("Content-type: application/json");
         header("Content-Disposition: attachment; filename=\"pimponexport.objects." . $object->getKey() . ".json\"");
         echo file_get_contents($exportFile);
         exit;
     } catch (Exception $ex) {
         Logger::err($ex->getMessage());
         $this->_helper->json(array("success" => false, "data" => 'error'), false);
     }
     $this->getResponse()->setHeader("Content-Type", "text/html");
 }
开发者ID:jv10,项目名称:pimpon,代码行数:17,代码来源:ObjectController.php

示例11: getById

 /**
  * Get the data for the object from database for the given id
  * @param integer $id
  * @return void
  */
 public function getById($id)
 {
     $data = $this->db->fetchRow("SELECT * FROM notes WHERE id = ?", $id);
     if (!$data["id"]) {
         throw new Exception("Note item with id " . $id . " not found");
     }
     $this->assignVariablesToModel($data);
     // get key-value data
     $keyValues = $this->db->fetchAll("SELECT * FROM notes_data WHERE id = ?", $id);
     $preparedData = array();
     foreach ($keyValues as $keyValue) {
         $data = $keyValue["data"];
         $type = $keyValue["type"];
         $name = $keyValue["name"];
         if ($type == "document") {
             if ($data) {
                 $data = Document::getById($data);
             }
         } else {
             if ($type == "asset") {
                 if ($data) {
                     $data = Asset::getById($data);
                 }
             } else {
                 if ($type == "object") {
                     if ($data) {
                         $data = Object_Abstract::getById($data);
                     }
                 } else {
                     if ($type == "date") {
                         if ($data > 0) {
                             $data = new Zend_Date($data);
                         }
                     } else {
                         if ($type == "bool") {
                             $data = (bool) $data;
                         }
                     }
                 }
             }
         }
         $preparedData[$name] = array("data" => $data, "type" => $type);
     }
     $this->model->setData($preparedData);
 }
开发者ID:shanky0110,项目名称:pimcore-custom,代码行数:50,代码来源:Resource.php

示例12: getNavigationPath

 public function getNavigationPath()
 {
     $topLevel = $this;
     $categories = array();
     $root = Object_Abstract::getById(47);
     //Pimcore_Config::getWebsiteConfig()->shopCategoriesFolder;
     while ($topLevel && $topLevel->getId() != $root->getId()) {
         $categories[] = $topLevel;
         $topLevel = $topLevel->getParent();
     }
     $categories = array_reverse($categories);
     $path = '';
     foreach ($categories as $category) {
         $path .= Website_Tool_Text::toUrl($category->getText()) . '/';
     }
     $path = substr($path, 0, strlen($path) - 1);
     return $path;
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:18,代码来源:Theme.php

示例13: setTargetId

 /**
  * @param int $targetId
  */
 public function setTargetId($targetId)
 {
     $this->targetId = $targetId;
     try {
         if ($this->type == "object") {
             $this->target = Object_Abstract::getById($targetId);
         } else {
             if ($this->type == "asset") {
                 $this->target = Asset::getById($targetId);
             } else {
                 if ($this->type == "document") {
                     $this->target = Document::getById($targetId);
                 } else {
                     Logger::log(get_class($this) . ": could not set resource - unknown type[" . $this->type . "]");
                 }
             }
         }
     } catch (Exception $e) {
         Logger::log(get_class($this) . ": Error setting resource");
     }
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:24,代码来源:RatingsComments.php

示例14: commentsAction

 public function commentsAction()
 {
     if ($this->_getParam('xaction') == "destroy") {
         $id = $this->_getParam("comments");
         $id = str_replace('"', '', $id);
         RatingsComments_Plugin::deleteComment($id);
         $results["success"] = true;
         $results["comments"] = "";
     } else {
         $id = $this->_getParam("objectid");
         $type = $this->_getParam("type");
         if ($type == "object") {
             $target = Object_Abstract::getById($id);
         } else {
             if ($type == "page" || $type == "snippet") {
                 $target = Document::getById($id);
             } else {
                 //try asset
                 $target = Asset::getById($id);
             }
         }
         $comments = RatingsComments_Plugin::getComments($target);
         $results = array();
         if (is_array($comments)) {
             foreach ($comments as $comment) {
                 $shorttext = $comment->getComment();
                 if (strlen($shorttext) > 50) {
                     $shorttext = substr($shorttext, 0, 50) . "...";
                 }
                 $results["comments"][] = array("c_id" => $comment->getId(), "c_shorttext" => $shorttext, "c_text" => $comment->getComment(), "c_rating" => $comment->getRating(), "c_user" => $comment->getName(), "c_created" => $comment->getDate());
             }
         }
         if (!isset($results["comments"])) {
             $results["comments"] = "";
         }
     }
     echo Zend_Json::encode($results);
     $this->removeViewRenderer();
 }
开发者ID:ascertain,项目名称:NGshop,代码行数:39,代码来源:AdminController.php

示例15: reassignReferences

 private function reassignReferences()
 {
     foreach ($this->bindReferencesCollection as $objectPath => $propertiesCollection) {
         $objectId = $this->objectMap[$objectPath];
         $object = Object_Abstract::getById($objectId);
         foreach ($propertiesCollection as $property => $referencesCollection) {
             $value = null;
             foreach ($referencesCollection as $reference) {
                 $referenceInstance = $this->getReferenceInstance($reference);
                 if ($reference->type === PimPon_Object_Encoder_Href::TYPE) {
                     $value = $referenceInstance;
                 } else {
                     if ($reference->type === PimPon_Object_Encoder_Collection::TYPE) {
                         $value[] = $referenceInstance;
                     }
                 }
             }
             $object->{'set' . ucfirst($property)}($value);
             $object->save();
         }
     }
 }
开发者ID:jv10,项目名称:pimpon,代码行数:22,代码来源:Import.php


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