evolution items
This commit is contained in:
parent
1a54b9a3f9
commit
629d77175a
|
@ -7,7 +7,7 @@ use Doctrine\Common\Collections\ArrayCollection;
|
|||
|
||||
class ItemRepository extends EntityRepository
|
||||
{
|
||||
public function getUserItems($user,&$bookmarks,&$itemsordered,&$itemcategorys,$iditemcategory=null,$ssoitems,$withbookmark=1,$fgessential=false) {
|
||||
public function getUserItems($user,&$bookmarks,&$itemsordered,&$itemcategorys,$iditemcategory=null,$ssoitems=[],$withbookmark=1,$fgessential=false) {
|
||||
// Profilage
|
||||
$roles=($user?$user->getRoles():["ROLE_ANONYME"]);
|
||||
$groups=($user?$user->getGroups():[]);
|
||||
|
@ -114,26 +114,28 @@ class ItemRepository extends EntityRepository
|
|||
|
||||
// Récupération des items par ssoitem
|
||||
$itemsssoitems=[];
|
||||
foreach($ssoitems as $ssoitem) {
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('item')
|
||||
->from("CadolesPortalBundle:Item", 'item')
|
||||
->where("item.ssoitem=:ssoitem ")
|
||||
->setParameter("ssoitem",$ssoitem);
|
||||
|
||||
if($iditemcategory && $itemcategoryfilter) {
|
||||
$qb->andWhere("item.itemcategory=:itemcategory")
|
||||
->setParameter("itemcategory",$itemcategoryfilter);
|
||||
}
|
||||
|
||||
$itemsssoitems=$qb->getQuery()->getResult();
|
||||
foreach($itemsssoitems as $itemssoitem) {
|
||||
if(!$bookmarksitems->contains($itemssoitem) && !$items->contains($itemssoitem)) {
|
||||
if(!$fgessential || ($fgessential && $itemssoitem->getEssential()))
|
||||
$items->add($itemssoitem);
|
||||
if(is_array($ssoitems)) {
|
||||
foreach($ssoitems as $ssoitem) {
|
||||
$qb = $this->getEntityManager()->createQueryBuilder();
|
||||
$qb->select('item')
|
||||
->from("CadolesPortalBundle:Item", 'item')
|
||||
->where("item.ssoitem=:ssoitem ")
|
||||
->setParameter("ssoitem",$ssoitem);
|
||||
|
||||
if($iditemcategory && $itemcategoryfilter) {
|
||||
$qb->andWhere("item.itemcategory=:itemcategory")
|
||||
->setParameter("itemcategory",$itemcategoryfilter);
|
||||
}
|
||||
|
||||
if(!$itemalls->contains($itemssoitem)) $itemalls->add($itemssoitem);
|
||||
$itemsssoitems=$qb->getQuery()->getResult();
|
||||
foreach($itemsssoitems as $itemssoitem) {
|
||||
if(!$bookmarksitems->contains($itemssoitem) && !$items->contains($itemssoitem)) {
|
||||
if(!$fgessential || ($fgessential && $itemssoitem->getEssential()))
|
||||
$items->add($itemssoitem);
|
||||
}
|
||||
|
||||
if(!$itemalls->contains($itemssoitem)) $itemalls->add($itemssoitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue