setBody() публичный Метод

Set body
public setBody ( string $body )
$body string
Пример #1
0
 public function load(ObjectManager $om)
 {
     $page = new AdminPage();
     $page->setBody("<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.\n Autem maxime molestiae, perspiciatis praesentium qui ut voluptatem! Ab aliquid amet\n aspernatur aut beatae blanditiis consectetur cupiditate ducimus eum ex excepturi\n facilis fugiat harum inventore labore minus modi nam natus necessitatibus nostrum\n odio optio, pariatur perspiciatis placeat, praesentium quaerat, quisquam quo\n recusandae repellendus rerum sapiente sequi similique sunt veniam vitae voluptatem\n  voluptatum! Architecto commodi cumque, deleniti, eum eveniet ex excepturi harum\n   incidunt magni natus pariatur, placeat provident quas repudiandae sit unde vel vero.\n    Ad adipisci autem dignissimos doloribus ducimus eum illum incidunt ipsa,\n    libero magnam minima minus, nihil porro praesentium suscipit vitae!</p>");
     $page->setTags("demo,test");
     $page->setTitle("Demo content");
     $page->setImage("logo.png");
     $om->persist($page);
     $om->flush();
 }
Пример #2
0
 public function testDelete()
 {
     $em = $this->em;
     $entity = new AdminPage();
     $entity->setCurrentLocale($this->locale);
     $entity->setTitle('Title Delete - phpunit');
     $entity->setBody('Body');
     $entity->setVisible(true);
     $em->persist($entity);
     $em->flush();
     $id = $entity->getId();
     $this->logIn();
     $client = $this->client;
     $token = $this->generateToken('ojs_admin_page' . $id);
     $client->request('DELETE', '/admin/page/' . $id . '/delete', array('_token' => $token));
     $this->assertStatusCode(302, $client);
 }
Пример #3
0
 protected function createDefaultPages()
 {
     $pages = [['about', 'About', 'About page content goes here.'], ['privacy', 'Privacy', 'Privacy page content goes here.'], ['faq', 'FAQ', 'A list of frequently answered questions goes here.'], ['tos', 'Terms of Service', 'TOS page content goes here.']];
     $em = $this->getContainer()->get('doctrine')->getManager();
     foreach ($pages as $page) {
         $entity = $em->getRepository('OjsAdminBundle:AdminPage')->findOneBy(['slug' => $page[0]]);
         if (!$entity) {
             $entity = new AdminPage();
             $entity->setVisible(true);
             $entity->setCurrentLocale($this->getContainer()->getParameter('locale'));
             $entity->setSlug($page[0]);
             $entity->setTitle($page[1]);
             $entity->setBody($page[2]);
             $em->persist($entity);
         }
     }
     $em->flush();
 }