当前位置: 首页>>代码示例>>PHP>>正文


PHP GetEntityManager函数代码示例

本文整理汇总了PHP中GetEntityManager函数的典型用法代码示例。如果您正苦于以下问题:PHP GetEntityManager函数的具体用法?PHP GetEntityManager怎么用?PHP GetEntityManager使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了GetEntityManager函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 protected function setUp()
 {
     $this->court = new Court(true);
     $this->entityManager = GetEntityManager();
     $this->courtRepository = $this->entityManager->getRepository('AppBundle\\Entity\\Court');
     $this->total = count($this->courtRepository->findAll());
 }
开发者ID:RaquelDiazG,项目名称:PHP_ClubPadel,代码行数:7,代码来源:CourtIntegrationTest.php

示例2: setUpBeforeClass

 public static function setUpBeforeClass()
 {
     self::$entityManager = GetEntityManager();
     // Build the schema for sqlite
     self::generateSchema();
     $newCustomer = new Customer();
     $newCustomer->setActive(true);
     $newCustomer->setName('Name 1');
     self::$entityManager->persist($newCustomer);
     $newPost = new Post();
     $newPost->setCustomer($newCustomer);
     $newPost->setDate(new \DateTime('2016-07-12 16:30:12.000000'));
     $newPost->setDescription('Description test');
     self::$entityManager->persist($newPost);
     $newComment = new Comment();
     $newComment->setPost($newPost);
     $newComment->setComment('Comment 1');
     self::$entityManager->persist($newComment);
     $newComment2 = new Comment();
     $newComment2->setPost($newPost);
     $newComment2->setComment('Comment 2');
     $newComment2->setParentComment($newComment);
     self::$entityManager->persist($newComment2);
     self::$entityManager->flush();
     self::$classConfig = [CustomerMapping::class, PostMapping::class, CommentMapping::class];
     parent::setUpBeforeClass();
 }
开发者ID:nilportugues,项目名称:json-api,代码行数:27,代码来源:AbstractTestCase.php

示例3: GetEntityManager

<?php

require_once __DIR__ . '/../../config/bootstrap.php';
//Get all courts
$entityManager = GetEntityManager();
$courtRepository = $entityManager->getRepository('AppBundle\\Entity\\Court');
$courts = $courtRepository->findAll();
//Print all courts
echo sprintf("  %2s: %10s\n", 'Id', 'Active:');
foreach ($courts as $court) {
    echo sprintf("- %2d: %10s\n", $court->getId(), $court->getActive() ? 'true' : 'false');
}
echo "\nTotal: " . count($courts) . " courts.\n\n";
开发者ID:RaquelDiazG,项目名称:PHP_ClubPadel,代码行数:13,代码来源:list_courts.php

示例4: basename

<?php

require_once __DIR__ . '/../../../config/bootstrap.php';
if ($argc < 2) {
    echo "Usage: " . basename(__FILE__) . " ids=id_1,id_2,...,id_n" . PHP_EOL;
    exit;
}
$cmd_data = [];
parse_str(implode('&', array_slice($argv, 1)), $cmd_data);
$groups_ids = explode(',', $cmd_data['ids']);
$em = GetEntityManager();
$groupRepository = $em->getRepository('AppBundle\\Entity\\Group');
foreach ($groups_ids as $group_id) {
    $group = $groupRepository->find($group_id);
    if ($group) {
        $em->remove($group);
        echo "Removed group: {$group_id}" . PHP_EOL;
    } else {
        echo "Group with id {$group_id} was not found" . PHP_EOL;
    }
}
$em->flush();
开发者ID:fer2d2,项目名称:fernando.moro.php.ecp1,代码行数:22,代码来源:delete_groups.php

示例5: eventadd

function eventadd()
{
    $em = GetEntityManager();
    $titre = $_POST['titre'];
    $description = $_POST['description'];
    $id_sport = $_POST['sport'];
    $sport = $em->find('Sport', $id_sport);
    $lieu = $_POST['lieu'];
    $date = $_POST['date'];
    $events = $em->getRepository('Evenement')->findAll();
    if ($titre == "" || $lieu == "" || $date == "") {
        operation_error("Le nom est vide");
    } else {
        $event = new Evenement($sport, $date, $lieu, $titre, $description);
        $em->persist($event);
        $em->flush();
        operation_success();
    }
    header('Location: ?/admin');
}
开发者ID:guillaumeLamanda,项目名称:site_bds,代码行数:20,代码来源:controller.php

示例6:

<?php

/**
 * based on cli-config.php from
 * http://doctrine-orm.readthedocs.io/projects/doctrine-orm/en/latest/reference/configuration.html
 */
use Doctrine\ORM\Tools\Console\ConsoleRunner;
require_once __DIR__ . '/../tests/Integrations/Doctrine/bootstrap.php';
//global $entityManager from boostrap.php
return ConsoleRunner::createHelperSet(GetEntityManager());
开发者ID:nilportugues,项目名称:json-api,代码行数:10,代码来源:cli-config.php


注:本文中的GetEntityManager函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。