Answers.Body: <p>The description you define in <code>getDescription()</code> is just the default description in the event that no description was specified when <code>craft()-&gt;tasks-&gt;createTask()</code> was called.</p>
  
  <p>The <em>actual</em> description for the task is saved on the TaskModel, which you can get via <code>$this-&gt;model</code> from your Task class:</p>
  
  <pre><code>$description = $this-&gt;model-&gt;description;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-07-16T22:52:35.923Z
Answers.LastActivityDate: 2014-07-16T22:52:35.923Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>I know that I can get the default description of a Task with:</p>
  
  <pre class="lang-php prettyprint-override"><code>$this-&gt;description;
  //or
  $this-&gt;getDescription();
  </code></pre>
  
  <p>But how can I get the description if it got changed on creation:</p>
  
  <pre class="lang-php prettyprint-override"><code>craft()-&gt;tasks-&gt;createTask('Mailer', $new_description);
  </code></pre>
  
  <p>Adding it as an attribute doesn't seem "right" to me:</p>
  
  <pre class="lang-php prettyprint-override"><code>craft()-&gt;tasks-&gt;createTask('Mailer', $new_description, array('description' =&gt; $new_description));
  </code></pre>
  
Tags: <plugin-development><tasks>
Title: How to get a Task's description inside runStep()?
ThreadText: # How to get a Task's description inside runStep()?
  
  (Asked by: username_0 on 2014-07-16)
  
  I know that I can get the default description of a Task with:
  
  ```php
  $this->description;
  //or
  $this->getDescription();
  
  ```
  
  But how can I get the description if it got changed on creation:
  
  ```php
  craft()->tasks->createTask('Mailer', $new_description);
  
  ```
  
  Adding it as an attribute doesn't seem "right" to me:
  
  ```php
  craft()->tasks->createTask('Mailer', $new_description, array('description' => $new_description));
  
  ```
  
  **Tags:** plugin-development, tasks
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-07-16. Score: 3 | Accepted answer
  
  The description you define in `getDescription()` is just the default description in the event that no description was specified when `craft()->tasks->createTask()` was called.
  
  The *actual* description for the task is saved on the TaskModel, which you can get via `$this->model` from your Task class:
  
  ```
  $description = $this->model->description;
  
  ```
  
  
  ---
  
  