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


PHP User::setProfile方法代码示例

本文整理汇总了PHP中Documents\User::setProfile方法的典型用法代码示例。如果您正苦于以下问题:PHP User::setProfile方法的具体用法?PHP User::setProfile怎么用?PHP User::setProfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Documents\User的用法示例。


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

示例1: setUp

 public function setUp()
 {
     parent::setUp();
     $this->ids = array();
     $groupA = new Group('groupA');
     $groupB = new Group('groupB');
     $profile = new Profile();
     $profile->setFirstname('Timothy');
     $tim = new User();
     $tim->setUsername('Tim');
     $tim->setHits(10);
     $tim->addGroup($groupA);
     $tim->addGroup($groupB);
     $tim->setProfile($profile);
     $this->dm->persist($tim);
     $john = new User();
     $john->setUsername('John');
     $john->setHits(10);
     $this->dm->persist($john);
     $this->dm->flush();
     $this->dm->clear();
     $this->ids['tim'] = $tim->getId();
     $this->ids['john'] = $john->getId();
     $this->fc = $this->dm->getFilterCollection();
 }
开发者ID:Wizkunde,项目名称:mongodb-odm,代码行数:25,代码来源:FilterTest.php

示例2: testLazyLoadReference

 public function testLazyLoadReference()
 {
     $user = new User();
     $profile = new Profile();
     $profile->setFirstName('Jonathan');
     $profile->setLastName('Wage');
     $user->setProfile($profile);
     $user->setUsername('jwage');
     $this->dm->persist($user);
     $this->dm->flush();
     $this->dm->clear();
     $query = $this->dm->createQuery('Documents\\User')->where('id', $user->getId());
     $user = $query->getSingleResult();
     $profile = $user->getProfile();
     $this->assertTrue($profile instanceof \Proxies\DocumentsProfileProxy);
     $profile->getFirstName();
     $this->assertEquals('Jonathan', $profile->getFirstName());
     $this->assertEquals('Wage', $profile->getLastName());
 }
开发者ID:poulikov,项目名称:mongodb-odm,代码行数:19,代码来源:ReferencesTest.php

示例3: testDocumentNotFoundExceptionWithMongoId

 /**
  * @expectedException \Doctrine\ODM\MongoDB\DocumentNotFoundException
  * @expectedExceptionMessage The "Proxies\__CG__\Documents\Profile" document with identifier "abcdefabcdefabcdefabcdef" could not be found.
  */
 public function testDocumentNotFoundExceptionWithMongoId()
 {
     $profile = new Profile();
     $user = new User();
     $user->setProfile($profile);
     $this->dm->persist($profile);
     $this->dm->persist($user);
     $this->dm->flush();
     $this->dm->clear();
     $collection = $this->dm->getDocumentCollection(get_class($user));
     $invalidId = new \MongoId('abcdefabcdefabcdefabcdef');
     $collection->update(array('_id' => new \MongoId($user->getId())), array('$set' => array('profile.$id' => $invalidId)));
     $user = $this->dm->find(get_class($user), $user->getId());
     $profile = $user->getProfile();
     $profile->__load();
 }
开发者ID:EngrHaiderAli,项目名称:movein-servie,代码行数:20,代码来源:ReferencesTest.php

示例4: testDocumentNotFoundEvent

 public function testDocumentNotFoundEvent()
 {
     $profile = new Profile();
     $user = new User();
     $user->setProfile($profile);
     $this->dm->persist($profile);
     $this->dm->persist($user);
     $this->dm->flush();
     $this->dm->clear();
     $collection = $this->dm->getDocumentCollection(get_class($user));
     $invalidId = new \MongoId('abcdefabcdefabcdefabcdef');
     $collection->update(array('_id' => new \MongoId($user->getId())), array('$set' => array('profile.$id' => $invalidId)));
     $user = $this->dm->find(get_class($user), $user->getId());
     $profile = $user->getProfile();
     $closure = function (DocumentNotFoundEventArgs $eventArgs) use($profile) {
         $this->assertFalse($eventArgs->isExceptionDisabled());
         $this->assertSame($profile, $eventArgs->getObject());
         $eventArgs->disableException();
     };
     $this->dm->getEventManager()->addEventListener(Events::documentNotFound, new DocumentNotFoundListener($closure));
     $profile->__load();
 }
开发者ID:alcaeus,项目名称:mongodb-odm,代码行数:22,代码来源:ReferencesTest.php

示例5: Configuration

$classLoader->register();
$config = new Configuration();
/*
$config->setLoggerCallable(function(array $log) {
    print_r($log);
});
$config->setMetadataCacheImpl(new ApcCache());
*/
$config->setProxyDir(__DIR__ . '/Proxies');
$config->setProxyNamespace('Proxies');
$reader = new AnnotationReader();
$reader->setDefaultAnnotationNamespace('Doctrine\\ODM\\MongoDB\\Mapping\\');
$config->setMetadataDriverImpl(new AnnotationDriver($reader, __DIR__ . '/Documents'));
//$config->setMetadataDriverImpl(new XmlDriver(__DIR__ . '/xml'));
//$config->setMetadataDriverImpl(new YamlDriver(__DIR__ . '/yaml'));
//$config->setMetadataDriverImpl(new PHPDriver());
$dm = DocumentManager::create(new Mongo(), $config);
$profile = new Profile();
$profile->setName('Jonathan H. Wage');
$profile->addSong(new Song('Testinfuckckcg'));
$user = new User();
$user->setUsername('jwage');
$user->setPassword('changeme');
$user->addPhonenumber(new Phonenumber('6155139185'));
$user->setProfile($profile);
$configuration = new ConfigurationDoc();
$configuration->setTimezone('Eastern');
$configuration->setTheme('doctrine');
$user->setConfiguration($configuration);
$dm->persist($user);
$dm->flush();
开发者ID:jacques-sounvi,项目名称:addressbook,代码行数:31,代码来源:example.php


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