'workshopThematic', | 'workshopThematic', | ||||
'title', | 'title', | ||||
'entries', | 'entries', | ||||
'status' | |||||
]; | ]; | ||||
} | } | ||||
return [ | return [ | ||||
'workshopThematic', | 'workshopThematic', | ||||
'type', | 'type', | ||||
'title', | |||||
'hook', | 'hook', | ||||
'title', | |||||
'description', | 'description', | ||||
//'entries' | |||||
'status' | |||||
]; | ]; | ||||
} | } | ||||
'type' => AssociationField::new('type'), | 'type' => AssociationField::new('type'), | ||||
'title' => TextField::new('title'), | 'title' => TextField::new('title'), | ||||
'hook' => TextField::new('hook'), | 'hook' => TextField::new('hook'), | ||||
'description' => TextareaField::new('description'), | |||||
'description' => CKEditorField::new('description'), | |||||
'entries' => AssociationField::new('entries') | 'entries' => AssociationField::new('entries') | ||||
->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig') | ->setTemplatePath('@LcPietro/admin/workshop/field/entries.html.twig') | ||||
]; | ]; |
protected $entries; | protected $entries; | ||||
/** | /** | ||||
* @ORM\Column(type="string", length=20, nullable=true) | |||||
* @ORM\Column(type="string", length=256, nullable=true) | |||||
*/ | */ | ||||
protected $hook; | protected $hook; | ||||
namespace Lc\PietroBundle\Repository\Workshop; | namespace Lc\PietroBundle\Repository\Workshop; | ||||
use Knp\Component\Pager\PaginatorInterface; | use Knp\Component\Pager\PaginatorInterface; | ||||
use Lc\PietroBundle\Model\Workshop\WorkshopThematicInterface; | |||||
use Lc\SovBundle\Repository\AbstractRepositoryQuery; | use Lc\SovBundle\Repository\AbstractRepositoryQuery; | ||||
class WorkshopRepositoryQuery extends AbstractRepositoryQuery | class WorkshopRepositoryQuery extends AbstractRepositoryQuery | ||||
{ | { | ||||
parent::__construct($repository, 'workshop', $paginator); | parent::__construct($repository, 'workshop', $paginator); | ||||
} | } | ||||
public function filterByWorkshopThematic(WorkshopThematicInterface $workshopThematic) | |||||
{ | |||||
return $this->andWhereEqual('workshopThematic', $workshopThematic); | |||||
} | |||||
} | } |
namespace Lc\PietroBundle\Repository\Workshop; | namespace Lc\PietroBundle\Repository\Workshop; | ||||
use Lc\PietroBundle\Model\Workshop\WorkshopThematicInterface; | |||||
use Lc\SovBundle\Repository\AbstractStore; | use Lc\SovBundle\Repository\AbstractStore; | ||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | use Lc\SovBundle\Repository\RepositoryQueryInterface; | ||||
public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | public function orderByDefault(RepositoryQueryInterface $query): RepositoryQueryInterface | ||||
{ | { | ||||
$query->orderBy('id'); | |||||
$query->orderBy('position'); | |||||
return $query; | return $query; | ||||
} | } | ||||
{ | { | ||||
return $query; | return $query; | ||||
} | } | ||||
public function findOnlineByWorkshopThematic(WorkshopThematicInterface $workshopThematic, $query = null) | |||||
{ | |||||
$query = $this->createDefaultQuery($query); | |||||
$query | |||||
->filterByWorkshopThematic($workshopThematic) | |||||
->filterIsOnline(); | |||||
return $query->find(); | |||||
} | |||||
} | } |