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


PHP object::create方法代码示例

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


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

示例1: store

 /**
  * Create new task and relation(s)
  *
  * @param  CreateTaskRequest $request
  *
  * @return mixed
  */
 public function store(CreateTaskRequest $request)
 {
     $input = $request->only('body', 'date', 'taskable');
     $task = $this->task->create(['body' => $input['body'], 'date' => $input['date']]);
     foreach ($input['taskable'] as $taskable => $id) {
         $task->{$taskable}()->attach($id);
     }
 }
开发者ID:keevitaja,项目名称:crm.keevitaja.com,代码行数:15,代码来源:TasksController.php

示例2: notify

 /**
  * Notifies about an alarm through Horde_Notification.
  *
  * @param array $alarm  An alarm hash.
  */
 public function notify(array $alarm)
 {
     $notification = $this->_notification->create();
     $notification->push($alarm['title'], 'horde.alarm', array('alarm' => $alarm));
     if (!empty($alarm['params']['notify']['sound']) && !isset($this->_soundPlayed[$alarm['params']['notify']['sound']])) {
         $notification->attach('audio');
         $notification->push($alarm['params']['notify']['sound'], 'audio');
         $this->_soundPlayed[$alarm['params']['notify']['sound']] = true;
     }
 }
开发者ID:raz0rsdge,项目名称:horde,代码行数:15,代码来源:Notify.php

示例3: store

 /**
  * Create new comment and relation(s)
  *
  * @param  CreateCommentRequest $request
  *
  * @return mixed
  */
 public function store(CreateCommentRequest $request)
 {
     $input = $request->only('body', 'commentable');
     $comment = $this->comment->create(['body' => $input['body']]);
     foreach ($input['commentable'] as $commentable => $id) {
         $comment->{$commentable}()->attach($id);
     }
     if (!$request->ajax()) {
         return back();
     }
 }
开发者ID:keevitaja,项目名称:crm.keevitaja.com,代码行数:18,代码来源:CommentsController.php

示例4: setUp

    /**
     * Sets up the fixture, for example, open a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp()
	{
		global $g_ado_db;

		$query = "DELETE FROM Languages WHERE Name = '" . $this->m_languageData['Name'] . "'";
		$g_ado_db->Execute($query);

		$this->m_languageObj = new Language();
		$this->m_languageObj->create($this->m_languageData);
		$this->m_metaLanguageObj = new MetaLanguage($this->m_languageObj->getLanguageId());
	}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:17,代码来源:MetaLanguageTest.php

示例5: push

 /**
  * Push a message onto the end of the queue
  *
  * @param array $message
  * @return mixed
  */
 public function push($message)
 {
     $mid = $this->implement->create($message);
     if ($mid === false || $this->implement->error()) {
         $this->error = $this->implement->error();
         return false;
     }
     if ($this->monitor->isReady()) {
         $this->monitor->update();
     }
     return $mid;
 }
开发者ID:laiello,项目名称:truelegend,代码行数:18,代码来源:Manager.php

示例6: execute

 /**
  * Execute action
  *
  * @return \Magento\Backend\Model\View\Result\Redirect
  * @throws \Magento\Framework\Exception\LocalizedException|\Exception
  */
 public function execute()
 {
     try {
         $collection = $this->filter->getCollection($this->collectionFactory->create());
         return $this->massAction($collection);
     } catch (\Exception $e) {
         $this->messageManager->addError($e->getMessage());
         /** @var \Magento\Backend\Model\View\Result\Redirect $resultRedirect */
         $resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
         return $resultRedirect->setPath($this->redirectUrl);
     }
 }
开发者ID:whoople,项目名称:magento2-testing,代码行数:18,代码来源:AbstractMassAction.php

示例7: sort

 /**
  * Sort by column
  *
  * @param  string $name
  * @param  string $column
  *
  * @return response
  */
 public function sort($name, $column)
 {
     if ($this->sorter->existsForLoggedUser($name)) {
         $sorter = $this->sorter->getByNameAndLoggedUser($name);
         if ($sorter->column == $column) {
             $this->sorter->toggleDesc($sorter->id);
             return redirect()->back();
         }
         $this->sorter->deleteByNameAndLoggedUser($name);
     }
     $this->sorter->create(['name' => $name, 'column' => $column]);
     return redirect()->back();
 }
开发者ID:keevitaja,项目名称:crm.keevitaja.com,代码行数:21,代码来源:Sorter.php

示例8: create

 /**
  * Creates the cache file.
  *
  * @since 6.2.0
  * @param int|string $key
  *            Unique key of the cache file.
  * @param mixed $data
  *            Data that should be cached.
  * @param string $namespace
  *            Optional. Where the cache contents are namespaced.
  * @param int $ttl
  *            Time to live sets the life of the cache file.
  */
 public function create($key, $data, $namespace = 'default', $ttl = 0)
 {
     if (empty($namespace)) {
         $namespace = 'default';
     }
     return $this->_cache->create($key, $data, $namespace, (int) $ttl);
 }
开发者ID:parkerj,项目名称:eduTrac-SIS,代码行数:20,代码来源:etsis_Object_Cache.php

示例9: addToList

 /**
  * Find a Ip in the data source
  *
  * @param  string $ip
  * @return object|null
  */
 public function addToList($whitelist, $ip)
 {
     $this->model->unguard();
     $model = $this->model->create(array('ip_address' => $ip, 'whitelisted' => $whitelist));
     $this->cacheRemember($model);
     return $model;
 }
开发者ID:Rahul-Giri,项目名称:firewall,代码行数:13,代码来源:Firewall.php

示例10: import_tweet

 protected function import_tweet(\stdClass $tweet)
 {
     $tweet = $this->get_real_tweet($tweet);
     $this->post->set_tweet($tweet);
     $post_id = $this->post->create();
     return $post_id;
 }
开发者ID:cibulka,项目名称:cibulka-wp-plugin-social,代码行数:7,代码来源:Import.php

示例11: createEmailAlerts

 /**
  * @param $pageId
  * @param $emails
  *
  * @return mixed
  */
 public function createEmailAlerts($pageId, $emails)
 {
     $base_url = $this->url_components['server'] . $this->url_components['6.0'] . "profiles/%d/pages/%d/email_alerts";
     $url = sprintf($base_url, $this->url_components['profiles'], $pageId);
     $this->api->setupRequest($this->base_params['ACCESS_TOKEN'], $emails);
     return $this->api->create($url);
 }
开发者ID:ZerionSoftware,项目名称:iFormBuilderAPI-v60,代码行数:13,代码来源:testiForm.php

示例12: _getUserInfo

 /**
  * Returns principal details.
  *
  * @param string $user  A user name.
  *
  * @return array  A hash with user information.
  */
 protected function _getUserInfo($user)
 {
     if ($user == '-system-') {
         return array('uri' => 'principals/-system-', '{DAV:}displayname' => Horde_Dav_Translation::t("System"));
     }
     $identity = $this->_identities->create($user);
     return array('uri' => 'principals/' . $user, '{DAV:}displayname' => $identity->getName(), '{http://sabredav.org/ns}email-address' => (string) $identity->getDefaultFromAddress());
 }
开发者ID:jubinpatel,项目名称:horde,代码行数:15,代码来源:Principals.php

示例13: testBindingByName

 public function testBindingByName()
 {
     $post = new Record(array('model' => $this->_model, 'data' => array('author_id' => '2', 'title' => 'New post', 'body' => 'New post body')));
     $info = new Record(array('model' => $this->_model2, 'data' => array('section' => 'New post section', 'notes' => 'New post notes')));
     $this->form->create(compact('post', 'info'));
     $this->assertEqual($post, $this->form->binding('post'));
     $this->assertEqual($info, $this->form->binding('info'));
 }
开发者ID:nilamdoc,项目名称:KYCGlobal,代码行数:8,代码来源:FormTest.php

示例14: sprintf

 /**
  * Event: new_faq
  * Triggered after FAQ addition
  * @param xhelpTicket $ticket Ticket used as base for FAQ
  * @param xhelpFaq $faq FAQ that was added
  */
 function new_faq($ticket, $faq)
 {
     global $xoopsUser;
     $logMessage =& $this->_hLog->create();
     $logMessage->setVar('uid', $xoopsUser->getVar('uid'));
     $logMessage->setVar('ticketid', $ticket->getVar('id'));
     $logMessage->setVar('action', sprintf(_XHELP_LOG_NEWFAQ, $faq->getVar('subject')));
     return $this->_hLog->insert($logMessage, true);
 }
开发者ID:trabisdementia,项目名称:xuups,代码行数:15,代码来源:logService.php

示例15: testFormCreationWithNoContext

	public function testFormCreationWithNoContext() {
		$this->form = new Form(array('context' => new MockFormRenderer(array(
			'request' => new Request(array('base' => '/bbq'))
		))));
		$result = $this->form->create(null, array('url' => '/foo'));

		$this->assertTags($result, array('form' => array(
			'action' => "/bbq/foo", 'method'=> "post"
		)));
	}
开发者ID:niel,项目名称:lithium,代码行数:10,代码来源:FormTest.php


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