本文整理匯總了PHP中type::getRepository方法的典型用法代碼示例。如果您正苦於以下問題:PHP type::getRepository方法的具體用法?PHP type::getRepository怎麽用?PHP type::getRepository使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類type
的用法示例。
在下文中一共展示了type::getRepository方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: all
/**
*
* @return type
*/
public function all($entity)
{
$result = $this->manager->getRepository($entity)->findAll();
#Verificando se algum registro foi encontrado
if ($result == null) {
throw new NoResultException("Nenhum registro encotrado");
}
return $result;
}
示例2: all
/**
*
* @return type
*/
public function all()
{
try {
$arrayResult = $this->manager->getRepository("SerBinarioSecurityBundle:Perfil")->findAll();
return $arrayResult;
} catch (Exception $ex) {
return null;
}
}
示例3: postOrderTraversal
/**
* @param type $tree tree
* @param type $begin begin
* @param type &$end end
* @param type $em em
*/
public function postOrderTraversal($tree, $begin, &$end, $em)
{
//get $tree childrens
$children = $em->getRepository('CMSAdminBUndle:Menu')->getChildren($tree->getId());
$tree->setLft($begin);
$end = ++$begin;
//Travesal the tree
foreach ($children as $child) {
$repositor = $em->getRepository('CMSAdminBUndle:Menu');
$repositor->postOrderTraversal($child, $begin, $end, $em);
$begin = ++$end;
}
$tree->setRgt($end);
}
示例4: populateDogodekSplosni
/**
*
* @param type $manager
* @param type $v
*/
public function populateDogodekSplosni($manager, $v)
{
$rep = $manager->getRepository('Koledar\\Entity\\DogodekSplosni');
$o = null;
$nov = false;
if (!$o) {
$o = new \Koledar\Entity\DogodekSplosni();
$nov = true;
}
$o->setTitle($v[1]);
$o->setStatus($v[2]);
$date = empty($v[3]) ? null : date_create($v[3]);
$o->setZacetek($date);
$date = empty($v[4]) ? null : date_create($v[4]);
$o->setKonec($date);
$ref = $v[5] ? $this->getReference($v[5]) : null;
$o->setProstor($ref);
$ref = $v[6] ? $this->getReference($v[6]) : null;
// $o->setSezona($ref);
if ($nov) {
$rep->create($o);
} else {
$rep->update($o);
}
$referenca = 'DogodekSplosni-' . $v[0];
// var_dump($referenca);
$this->addReference($referenca, $o);
$referencaDog = 'DogodekSpl-' . $v[0];
$this->addReference($referencaDog, $o->getDogodek());
}
示例5: findBy
/**
*
* @param type $array
*/
public function findBy($array = array())
{
try {
$obj = $this->manager->getRepository($this->nameBundle)->findBy($array);
return $obj;
} catch (Exception $ex) {
return false;
}
}
示例6: findId
/**
*
* @param type $id
* @return type
*/
public function findId($id)
{
try {
$obj = $this->manager->getRepository('ProtocoloBundle:Encaminhamentos')->find($id);
return $obj;
} catch (Exception $ex) {
return null;
}
}
示例7: findNumOficio
/**
*
* @param type $numOficio
* @return type
*/
public function findNumOficio($numOficio, $idSecretaria)
{
try {
$obj = $this->manager->getRepository('Serbinario\\Bundles\\ProtocoloBundle\\Entity\\Documentos')->findBy(array('numOficio' => $numOficio, 'secretariasSecretaria' => $idSecretaria));
return $obj;
} catch (Exception $ex) {
return null;
}
}
示例8: populateOptions
/**
* Dodajanje opcij
*
* Vsebino yml datoteke ažurira v entitetah Option in OptionValue
*
* @param type $em entity manager
* @param type $val Ena opcija iz yml datoteke
*/
public function populateOptions($em, $val)
{
$optR = $em->getRepository('App\\Entity\\Option');
$o = $optR->findOneByName($val['name']);
$readOnly = empty($val['readOnly']) ? false : $val['readOnly'];
if (!$o) {
$o = new Option();
$em->persist($o);
$o->setName($val['name']);
} else {
/**
* spremembe naredimo le, če je readonly
*/
if (!$readOnly) {
return;
}
}
$o->setReadOnly($readOnly);
$o->setType($val['type']);
$o->setDescription($val['description']);
$o->setDefaultValue(empty($val['defaultValue']) ? null : $val['defaultValue']);
$o->setPerUser(empty($val['perUser']) ? false : $val['perUser']);
$o->setPublic(empty($val['public']) ? false : $val['public']);
$o->setRole(empty($val['role']) ? null : $val['role']);
/**
* če obstajajo globalne ali uporabniške vrednosti ažuriramo entiteto OptionValue:
*/
if (!empty($val['optionValue'])) {
echo " " . $val['name'] . ' -> not empty Option Value ' . PHP_EOL;
if (!empty($val['optionValue']['global'])) {
echo " global" . PHP_EOL;
/**
* ali obstaja globalna opcija ?
*/
$optValue = $em->getRepository('App\\Entity\\OptionValue')->getOptionValuesGlobalValue($o);
// pričakujemo, da najde največ 1 globalno vrednost.
if (empty($optValue)) {
$optVal = new OptionValue();
$optVal->setValue($val['optionValue']['global']['value']);
$optVal->setGlobal(true);
$optVal->addOption($o);
$em->persist($optVal);
}
echo " opt val: " . $val['optionValue']['global']['value'][0]['key'] . " " . $val['optionValue']['global']['value'][0]['value'] . PHP_EOL;
}
/**
* ali obstajajo uporabniške vrednosti
*/
if (!empty($val['optionValue']['user'])) {
$optValueUserY = $val['optionValue']['user'];
foreach ($optValueUserY as $user) {
echo " user " . $user['email'] . PHP_EOL;
// najprej preverim, če uporabniško ime že obstaja v entiteti User
$u = $em->getRepository('Aaa\\Entity\\User')->findOneByemail($user['email']);
$this->expect($u, "Ni tega uporabnika", 1000300);
// $$ rb potrebno še implementirati trnsl
// ali obstajajo opcije userja
$optValue = $em->getRepository('App\\Entity\\OptionValue')->getOptionValuesUserValue($o, $u);
if (empty($optValue)) {
$optVal = new OptionValue();
$optVal->setValue($user['value']);
$optVal->setGlobal(false);
$optVal->addOption($o);
$optVal->addUser($u);
$em->persist($optVal);
// ali je lahko več persistov pred flush-em?
}
echo " opt val: " . $user['value'][0]['key'] . " " . $user['value'][0]['value'] . PHP_EOL;
}
}
}
}