예제 #1
0
 /**
  * @param Note $entity
  * @return array
  */
 public function getEntityViewModel(Note $entity)
 {
     $result = ['id' => $entity->getId(), 'message' => $entity->getMessage(), 'createdAt' => $entity->getCreatedAt()->format('c'), 'updatedAt' => $entity->getUpdatedAt()->format('c'), 'hasUpdate' => $entity->getCreatedAt() != $entity->getUpdatedAt(), 'editable' => $this->securityFacade->isGranted('EDIT', $entity), 'removable' => $this->securityFacade->isGranted('DELETE', $entity)];
     $this->addUser($result, 'createdBy', $entity->getOwner());
     $this->addUser($result, 'updatedBy', $entity->getUpdatedBy());
     return $result;
 }
예제 #2
0
 public function testGettersSetters()
 {
     $note = new Note();
     $this->assertNull($note->getMessage());
     $this->assertNull($note->getId());
     $now = new \DateTime();
     $note->setCreatedAt($now)->setUpdatedAt($now)->setMessage('test');
     $this->assertEquals($now, $note->getCreatedAt());
     $this->assertEquals($now, $note->getUpdatedAt());
     $this->assertEquals('test', $note->getMessage());
     $user = new User();
     $note->setUpdatedBy($user)->setOwner($user);
     $this->assertSame($user, $note->getUpdatedBy());
     $this->assertEquals($user, $note->getOwner());
     $organization = new Organization();
     $this->assertNull($note->getOrganization());
     $note->setOrganization($organization);
     $this->assertSame($organization, $note->getOrganization());
 }
예제 #3
0
 /**
  * @Route("/update/{id}", name="oro_note_update", requirements={"id"="\d+"})
  *
  * @Template
  * @AclAncestor("oro_note_update")
  */
 public function updateAction(Note $entity)
 {
     $formAction = $this->get('router')->generate('oro_note_update', ['id' => $entity->getId()]);
     return $this->update($entity, $formAction);
 }