0
我用hautelook /翹bundleand我需要爲我的開發人員負載能力我寫SkillsLoader.php:燈具愛麗絲Symfony的
class LoadSkillssData extends AbstractFixture implements OrderedFixtureInterface
{
public function load(ObjectManager $manager)
{
$all_skills =
[
'doctrine 2',
'Memcache',
'QA',
'testing',
'web design',
'EJB 3'
];
for ($i = 1; $i<=172; $i++)
{
$skills = new Skills();
$skills -> setId($i);
$skills ->setSkill($all_skills[$i]);
$manager->persist($skills);
$manager->flush();
}
}
public function getOrder()
{
return 1; // the order in which fixtures will be loaded
}
但我創建實體技能SETID(),因爲我有錯誤ID不能爲空。但我的問題是如何使用YML文件我CANU PLOAD技能fixteures,這是愛麗絲bundleand我
Artel\CustomerBundle\Entity\Cities:
cities{1..50}:
city: <city()>
Artel\CustomerBundle\Entity\Developers:
users{1..20}:
location: @cities*
level: <?php $names = ['Junior', 'Middle', 'Senior']; echo $names[array_rand($names)]; ?>
main_skill: @skills*
firstName: <firstName()>
lastName: <lastName()>
username: <firstNameMale()>
telephone: <phoneNumber()>
skype: skypeName
email: <email()>
password: <password()>
roles: <?php $names = ['ROLE_ADMIN', 'ROLE_USER', 'ROLE_AGENT', 'ROLE_COMPANY']; echo $names[array_rand($names)]; ?>
Artel\CustomerBundle\Entity\Skills:
skills{1..30}:
skill: ????