1

I have a Task entity which contains a list of tasks with code and description properties :

/**
 * Task
 *
 * @ORM\Table(name="tasks")
 * @ORM\Entity(repositoryClass="Foo\BarBundle\Entity\TaskRepository")
 */
class Task
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(name="code", type="string", length=50)
     */
    private $code;

    /**
     * @ORM\Column(name="description", type="string", length=255)
     */
    private $description;

    // ...
}

I will wish that my users enter each week the time they passed on each task. I think the best is to create another entity, Activity for example, with a task property :

/**
 * Activity
 *
 * @ORM\Table(name="activities")
 * @ORM\Entity(repositoryClass="Foo\BarBundle\Entity\ActivityRepository")
 */
class Activity
{
    /**
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @ORM\Column(name="date", type="datetime")
     */
    private $date;

    /**
     * @ORM\Column(name="duration", type="smallint")
     */
     private $duration;

    /**
     * @ORM\ManyToOne(targetEntity="Task", inversedBy="activities") // with activities property in Task entity
     * @ORM\JoinColumn(name="task_id", referencedColumnName="id")
     */
    private $task;

     // ...
}

But obviously the form displays the activity fields with a select form containing all the Tasks...

What is the best way to have all my tasks displayed in a single page, with the possibility to enter a value for each of them by week please ? (the week is given by a GET parameter).

Edit

A similar question with an answer which helped me can be found here.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.