Record start time.
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php Wed Sep 04 12:28:40 2013 +0900
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Controller/DefaultController.php Wed Sep 04 12:37:30 2013 +0900
@@ -78,6 +78,10 @@
if(null!=$title){
$editparam = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Talk')->updateTitle($talk, $title);
}
+ $current_post = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Post')->findBy(array('talk' =>$talk));
+ if(0==count($current_post)){
+ $start = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Talk')->start($talk);
+ }
echo 'Post:' . count($post);
if(0==count($post)){
$newpost = $this->getDoctrine()->getRepository('OrgW3AutotweetBundle:Post')->addnew($talk,$msg);
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Entity/Talk.php Wed Sep 04 12:28:40 2013 +0900
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Entity/Talk.php Wed Sep 04 12:37:30 2013 +0900
@@ -56,12 +56,19 @@
private $accesskey;
/**
+ * @var \DateTime
+ *
+ * @ORM\Column(name="started_at", type="datetime", nullable=true)
+ */
+ private $startedAt;
+
+ /**
* @var string
*
* @ORM\Column(name="user_id", type="integer")
*/
private $user_id;
-
+
/**
* @ORM\ManyToOne(targetEntity="User", inversedBy="talks")
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
@@ -255,4 +262,27 @@
{
return $this->author;
}
+
+ /**
+ * Set startedAt
+ *
+ * @param \DateTime $startedAt
+ * @return Talk
+ */
+ public function setStartedAt($startedAt)
+ {
+ $this->startedAt = $startedAt;
+
+ return $this;
+ }
+
+ /**
+ * Get startedAt
+ *
+ * @return \DateTime
+ */
+ public function getStartedAt()
+ {
+ return $this->startedAt;
+ }
}
\ No newline at end of file
--- a/autotweet-php/src/Org/W3/AutotweetBundle/Entity/TalkRepository.php Wed Sep 04 12:28:40 2013 +0900
+++ b/autotweet-php/src/Org/W3/AutotweetBundle/Entity/TalkRepository.php Wed Sep 04 12:37:30 2013 +0900
@@ -45,6 +45,18 @@
$em_default->flush();
return $post;
}
+
+
+ public function start($talk)
+ {
+ $em_default = $this->getEntityManager('default');
+
+ $now = new \DateTime('now');
+ $post= $talk;
+ $post->setStartedAt($now);
+ $em_default->flush();
+ return $post;
+ }
public function updateTitle($talk,$title)
{
$em_default = $this->getEntityManager('default');