Add posting

@author Tom Haskins-Vaughan <tom@harvestcloud.com>
@since  2012-05-03

@param  \HarvestCloud\CoreBundle\Entity\Posting $posting
189527
public function addPosting(\HarvestCloud\CoreBundle\Entity\Posting $posting)
    {
        $this->postings[] = $posting;
        $posting->setJournal($this);
    }
931392
public function delete(Post $post)
    {
        $response = $this->api->process(new DeletePost($post));
        if ($response->getStatusCode() == 200) {
            return true;
        } else {
            return false;
        }
    }
448390
public function addPost(Post $post)
    {
        $postName = $post->getName();

        if ($this->isPostRegistered($postName)) {
            throw new \InvalidArgumentException("Duplicate post $postName");
        }

        $this->registerPost($post);
    }
1289656
public function post($key = null, $default = null)
    {
        $posts = $this->getPostParams();

        return is_null($key) ? $posts : data_get($posts, $key, $default);
    }
1348096
public static function post($key, $default = null)
    {
        if (is_null($key)) {
            return $default;
        }

        return (isset($_POST[$key]) ? $_POST[$key] : $default);
    }
779023
public static function create($post)
    {
        // If numeric, create the post
        if (is_numeric($post)) {
            // Retrieve the transient
            $transientKey = sprintf('WPMVC\Models\Post(%d)', $post);
            $storedData = WP::getTransient($transientKey);
            // If the transient doesn't yet exist, query for it!
            if ($storedData === false) {
                // Retrieve the post object
                $post = WP::getPost(intval($post));
                // Store the transient
                WP::setTransient($transientKey, $post, static::$transientTimeout);
            } else {
                $post = $storedData;
            }
        } elseif (is_array($post)) {
            // Convert array into object
            $post = (object) $post;
        }
        return new static($post);
    }
63739
public function dispatchCommentCreateEvent(Post $post, Comment $comment)
    {
        $event = new LogCommentCreateEvent($post, $comment, $this->translator);

        return $this->dispatch($event);
    }
812131
public function setPostingFeeInvoice(\HarvestCloud\CoreBundle\Entity\Invoice\PostingFeeInvoice $postingFeeInvoice = null)
    {
        $this->postingFeeInvoice = $postingFeeInvoice;

        return $this;
    }
618520
public function post($key, $type = 'string', $default = null)
    {
        $value = $default;
        if (isset($this->post[$key])) {
            $value = $this->post[$key];
        }
        settype($value, $type);
        return $value;
    }
146961
public function setLastPost(Post $post)
    {
        $this->last_posted_at = $post->created_at;
        $this->last_posted_user_id = $post->user_id;
        $this->last_post_id = $post->id;
        $this->last_post_number = $post->number;

        return $this;
    }
1045874
protected function process_post_data($posts) {
        $discussionids = [];
        $forumids = [];
        $courseids = [];

        $this->log_start("Processing post information");

        $start = microtime(true);
        foreach ($posts as $id => $post) {
            $discussionids[$post->discussion] = true;
            $forumids[$post->forum] = true;
            $courseids[$post->course] = true;
            $this->add_data_for_post($post);
            $this->posts[$id] = $post;
        }
        $this->log_finish(sprintf("Processed %s posts", count($this->posts)));

        if (empty($this->posts)) {
            $this->log("No posts found. Returning early.");
            return;
        }

        // Please note, this order is intentional.
        // The forum cache makes use of the course.
        $this->log_start("Filling caches");

        $start = microtime(true);
        $this->log_start("Filling course cache", 1);
        $this->fill_course_cache(array_keys($courseids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling forum cache", 1);
        $this->fill_forum_cache(array_keys($forumids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling discussion cache", 1);
        $this->fill_discussion_cache(array_keys($discussionids));
        $this->log_finish("Done", 1);

        $this->log_start("Filling user subscription cache", 1);
        $this->fill_user_subscription_cache();
        $this->log_finish("Done", 1);

        $this->log_start("Filling digest cache", 1);
        $this->fill_digest_cache();
        $this->log_finish("Done", 1);

        $this->log_finish("All caches filled");

        $this->log_start("Queueing user tasks.");
        $this->queue_user_tasks();
        $this->log_finish("All tasks queued.");
    }
1284336
public function the_post( &$post_obj ) {
		if ( isset( $this->post_type_to_override[ $post_obj->post_type ] ) ) {
			// Post type exists. Let's override
			$class_name = $this->post_type_to_override[ $post_obj->post_type ];
			global $post;
			$post->helper = new $class_name( $post_obj );
		}
	}
1019335
public function post(string $pattern, array $param) : void
    {
        $this->call('post', $pattern, $param[0], $param[1], $param);
    }
790623
protected function add_data_for_post($post) {
        if (!isset($this->adhocdata[$post->course])) {
            $this->adhocdata[$post->course] = [];
        }

        if (!isset($this->adhocdata[$post->course][$post->forum])) {
            $this->adhocdata[$post->course][$post->forum] = [];
        }

        if (!isset($this->adhocdata[$post->course][$post->forum][$post->discussion])) {
            $this->adhocdata[$post->course][$post->forum][$post->discussion] = [];
        }

        $this->adhocdata[$post->course][$post->forum][$post->discussion][$post->id] = $post->id;
    }
11759
public function posted($method = 'post')
    {
        $postIndicator = $this->getPostIndicator();

        if ($postIndicator->posted($method)) {
            if ($method == 'post') {
                $this->setValues($_POST, $_FILES);
            } else if ($method == 'get') {
                $this->setValues($_GET);
            }
            return true;
        }

        return false;
    }
260337
public synchronized void post()
   {
    if (tc.isEntryEnabled()) SibTr.entry(tc, "post", ""+count);
      --count;
      if (count >= 0)
         notify();
    if (tc.isEntryEnabled()) SibTr.exit(tc, "post");
   }
587812
public function add()
    {
        $post = $this->Posts->newEntity();

        if ($this->request->is('post')) {
            //Only admins and managers can add posts on behalf of other users
            if (!$this->Auth->isGroup(['admin', 'manager'])) {
                $this->request = $this->request->withData('user_id', $this->Auth->user('id'));
            }

            $post = $this->Posts->patchEntity($post, $this->request->getData());

            if ($this->Posts->save($post)) {
                $this->Flash->success(I18N_OPERATION_OK);

                return $this->redirect(['action' => 'index']);
            }

            $this->Flash->error(I18N_OPERATION_NOT_OK);
        }

        $this->set(compact('post'));
    }