Unverified Commit 5030aaae authored by Sebastian Castro's avatar Sebastian Castro
Browse files

refactor: Fix other BiopenXXXBundle path (in command, repository ...)

parent c16e3bd6
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c83db3ec8f98cbe9e54ec352b18dd87a",
"content-hash": "859fa5df749eb01ea5858c2abfc6c77b",
"packages": [
{
"name": "alcaeus/mongo-php-adapter",
......
......@@ -19,8 +19,8 @@ sonata_admin:
# display a dashboard block
- { position: left, type: gogo.block.recent_elements, settings: { title: 'Dernières validation collaboratives', filterStatus: 2, class: box-success}}
- { position: right, type: gogo.block.recent_elements, settings: { title: 'Derniers refus collaboratifs', filterStatus: -3 , class: box-danger}}
- { position: top, class: col-md-12, type: sonata.block.service.monitoring}
- { position: top, class: col-md-12, type: sonata.block.service.charts}
- { position: top, class: col-md-12, type: gogo.block.service.monitoring}
- { position: top, class: col-md-12, type: gogo.block.service.charts}
groups:
Contenus:
icon: <i class='fa fa-file-text'></i>
......
sonata_block:
default_contexts: [sonata_page_bundle]
blocks:
gogo.block.service.monitoring: ~
gogo.block.service.charts: ~
gogo.block.recent_elements: ~
\ No newline at end of file
......@@ -41,6 +41,7 @@ services:
# - { resource: "../src/Saas/Resources/config/services.yml" }
# - { resource: "../src/Saas/Resources/config/services_admin.yml" }
# - { resource: "../src/Sonata/UserBundle/Resources/config/services.yml" }
gogo.authentication_handler:
class: App\Application\Sonata\UserBundle\Security\AuthenticationHandler
public: true
......@@ -91,12 +92,6 @@ services:
class: 'JMS\Serializer\Expression\ExpressionEvaluator'
arguments : ['@jms_serializer.expression_language']
# app.twig_extension:
# class: Application\Twig\AppExtension
# public: true
# arguments: [ "@doctrine.odm.mongodb.document_manager" ]
# tags:
# - { name: twig.extension }
custom.sonata.security.handler.role:
public: true
......@@ -107,23 +102,23 @@ services:
# # SONATA BLOCKS
# sonata.block.service.monitoring:
# class: App\Block\MonitoringElementsBlockService
# public: true
# arguments: [ "@templating", "@doctrine.odm.mongodb.document_manager" ]
# tags:
# - { name: sonata.block }
# sonata.block.service.charts:
# class: App\Block\ChartBlockService
# public: true
# arguments: [ "@templating", "@doctrine.odm.mongodb.document_manager", "@gogo.config_service" ]
# tags:
# - { name: sonata.block }
# gogo.block.recent_elements:
# class: App\Block\RecentElementsBlockService
# public: true
# arguments: [ "@templating", "@doctrine.odm.mongodb.document_manager", "@sonata.admin.pool" ]
# tags:
# - { name: sonata.block }
\ No newline at end of file
gogo.block.service.monitoring:
class: App\Block\MonitoringElementsBlockService
public: true
arguments: [ "@twig", "@doctrine.odm.mongodb.document_manager" ]
tags:
- { name: sonata.block }
gogo.block.service.charts:
class: App\Block\ChartBlockService
public: true
arguments: [ "@twig", "@doctrine.odm.mongodb.document_manager", "App/Services/ConfigurationService" ]
tags:
- { name: sonata.block }
gogo.block.recent_elements:
class: App\Block\RecentElementsBlockService
public: true
arguments: [ "@twig", "@doctrine.odm.mongodb.document_manager", "@sonata.admin.pool" ]
tags:
- { name: sonata.block }
\ No newline at end of file
......@@ -17,7 +17,7 @@ use Doctrine\ODM\MongoDB\DocumentManager;
use Ob\HighchartsBundle\Highcharts\Highchart;
use App\Document\InteractionType;
use App\Document\ElementStatus;
use Twig\Environment;
class ChartBlockService extends AbstractBlockService
{
......@@ -56,10 +56,10 @@ class ChartBlockService extends AbstractBlockService
'7' => '#7cb5ec',
];
public function __construct($templating, DocumentManager $dm, $configService)
public function __construct(Environment $twig, DocumentManager $dm, $configService)
{
$this->dm = $dm;
$this->templating = $templating;
$this->twig = $twig;
$this->configService = $configService;
}
......
......@@ -15,15 +15,16 @@ use Sonata\CoreBundle\Validator\ErrorElement;
use Sonata\BlockBundle\Block\Service\AbstractBlockService;
use Doctrine\ODM\MongoDB\DocumentManager;
use Twig\Environment;
class MonitoringElementsBlockService extends AbstractBlockService
{
protected $dm;
public function __construct($templating, DocumentManager $dm)
public function __construct(Environment $twig, DocumentManager $dm)
{
$this->dm = $dm;
$this->templating = $templating;
$this->dm = $dm;
$this->twig = $twig;
}
public function getName()
......@@ -51,8 +52,8 @@ class MonitoringElementsBlockService extends AbstractBlockService
$validateElements = $this->dm->getRepository('App\Document\Element')->findValidated(true);
$allVisibleElements = $this->dm->getRepository('App\Document\Element')->findVisibles(true, false);
$visibleNonImportedElements = $this->dm->getRepository('App\Document\Element')->findVisibles(true, true);
$activeUsersCount = $this->dm->createQueryBuilder('BiopenCoreBundle:User')->field('enabled')->equals(true)->count()->getQuery()->execute();
$activeUsersNewsletterCount = $this->dm->createQueryBuilder('BiopenCoreBundle:User')->field('enabled')->equals(true)
$activeUsersCount = $this->dm->createQueryBuilder('App\Document\User')->field('enabled')->equals(true)->count()->getQuery()->execute();
$activeUsersNewsletterCount = $this->dm->createQueryBuilder('App\Document\User')->field('enabled')->equals(true)
->field('newsletterFrequency')->gt(NewsletterFrequencyOptions::Never)->count()->getQuery()->execute();
$errors = $this->dm->getRepository('App\Document\GoGoLog')->findBy(['level' => 'error', 'hidden' => false]);
......
......@@ -13,6 +13,8 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Doctrine\ODM\MongoDB\DocumentManager;
use App\Document\ElementStatus;
use Twig\Environment;
/**
* @author Thomas Rabaix <thomas.rabaix@sonata-project.org>
*/
......@@ -29,11 +31,11 @@ class RecentElementsBlockService extends AbstractAdminBlockService
* @param DocumentManager $dm
* @param Pool $adminPool
*/
public function __construct(EngineInterface $templating, DocumentManager $dm, Pool $adminPool = null)
public function __construct(Environment $twig, DocumentManager $dm, Pool $adminPool = null)
{
$this->manager = $dm;
$this->adminPool = $adminPool;
parent::__construct("RecentElementsBlockService", $templating);
parent::__construct("RecentElementsBlockService", $twig);
}
/**
* {@inheritdoc}
......@@ -44,7 +46,7 @@ class RecentElementsBlockService extends AbstractAdminBlockService
'context' => $blockContext,
'settings' => $blockContext->getSettings(),
'block' => $blockContext->getBlock(),
'results' => $this->manager->createQueryBuilder('BiopenGeoDirectoryBundle:Element')
'results' => $this->manager->createQueryBuilder('App\Document\Element')
->field('status')->equals($blockContext->getSettings()['filterStatus'])
->sort('updatedAt', 'DESC')
->limit($blockContext->getSettings()['number'])
......
......@@ -22,7 +22,7 @@ class CheckExternalSourceToUpdateCommand extends GoGoAbstractCommand
protected function gogoExecute($dm, InputInterface $input, OutputInterface $output)
{
$qb = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:ImportDynamic');
$qb = $dm->createQueryBuilder('App\Document\ImportDynamic');
$dynamicImports = $qb->field('refreshFrequencyInDays')->gt(0)
->field('nextRefresh')->lte(new \DateTime())
......
......@@ -32,7 +32,7 @@ class GoGoMainCommand extends ContainerAwareCommand
{
$dm = $this->getContainer()->get('doctrine_mongodb.odm.default_document_manager');
$qb = $dm->createQueryBuilder('BiopenSaasBundle:ScheduledCommand');
$qb = $dm->createQueryBuilder('App\Document\ScheduledCommand');
$commandToExecute = $qb->field('nextExecutionAt')->lte(new \DateTime())
->sort('nextExecutionAt', 'ASC')
......
......@@ -61,7 +61,7 @@ class MigrationCommand extends GoGoAbstractCommand
protected function gogoExecute($dm, InputInterface $input, OutputInterface $output)
{
$migrationState = $dm->createQueryBuilder('BiopenCoreBundle:MigrationState')->getQuery()->getSingleResult();
$migrationState = $dm->createQueryBuilder('App\Document\MigrationState')->getQuery()->getSingleResult();
if ($migrationState == null) // Meaning the migration state was not yet in the place in the code
{
$migrationState = new MigrationState();
......@@ -71,7 +71,7 @@ class MigrationCommand extends GoGoAbstractCommand
try {
// Collecting the Database to be updated
$dbs = ['gogocarto_default'];
$dbNames = $dm->createQueryBuilder('BiopenSaasBundle:Project')->select('domainName')->hydrate(false)->getQuery()->execute()->toArray();
$dbNames = $dm->createQueryBuilder('App\Document\Project')->select('domainName')->hydrate(false)->getQuery()->execute()->toArray();
foreach ($dbNames as $object) { $dbs[] = $object['domainName']; }
if (count($this->migrations) > $migrationState->getMigrationIndex()) {
......
......@@ -30,7 +30,7 @@ class UpdateElementsJsonCommand extends GoGoAbstractCommand
}
else
{
$qb = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:Element');
$qb = $dm->createQueryBuilder('App\Document\Element');
$qb->field('id')->in(explode(',',$input->getArgument('ids')));
$elements = $qb->getQuery()->execute();
}
......
......@@ -347,7 +347,7 @@ class APIController extends GoGoController
public function hideAllLogsAction(DocumentManager $dm)
{
$qb = $dm->createQueryBuilder('BiopenCoreBundle:GoGoLog');
$qb = $dm->createQueryBuilder('App\Document\GoGoLog');
$qb->updateMany()
->field('type')->notEqual('update')
->field('hidden')->equals(false)
......@@ -357,7 +357,7 @@ class APIController extends GoGoController
public function hideAllMessagesAction(DocumentManager $dm)
{
$qb = $dm->createQueryBuilder('BiopenCoreBundle:GoGoLogUpdate');
$qb = $dm->createQueryBuilder('App\Document\GoGoLogUpdate');
$qb->updateMany()
->field('type')->equals('update')
->field('hidden')->equals(false)
......
......@@ -10,7 +10,7 @@ class DataUpdateActionsController extends BulkActionsAbstractController
{
public function updateGamificationAction(Request $request, SessionInterface $session, DocumentManager $dm)
{
$qb = $dm->createQueryBuilder('BiopenCoreBundle:User');
$qb = $dm->createQueryBuilder('App\Document\User');
$qb->field('email')->notEqual(null);
$query = $qb->getQuery();
$users = $query->execute();
......
......@@ -87,7 +87,7 @@ class ElementAdminBulkController extends Controller
}
// Clear previous interaction with same type pending to be dispatched (prevent dispatching multiple edit event)
$query = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:UserInteractionContribution')
$query = $dm->createQueryBuilder('App\Document\UserInteractionContribution')
->updateMany()
->field('type')->equals($contrib->getType())
->field('elements.id')->in($elementIds)
......@@ -113,7 +113,7 @@ class ElementAdminBulkController extends Controller
// BATCH RESOLVE REPORTS
if ($actionName == 'resolveReports')
{
$query = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:UserInteractionReport')
$query = $dm->createQueryBuilder('App\Document\UserInteractionReport')
->updateMany()
->field('isResolved')->notEqual(true)
->field('element.id')->in($elementIds)
......@@ -288,7 +288,7 @@ class ElementAdminBulkController extends Controller
$optionsValues = $selectedModel->getOptionValues()->toArray();
if ($optionstoRemoveIds && count($optionstoRemoveIds) > 0)
{
$optionsToRemove = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:Option')->field('id')->in($optionstoRemoveIds)
$optionsToRemove = $dm->createQueryBuilder('App\Document\Option')->field('id')->in($optionstoRemoveIds)
->getQuery()->execute()->toArray();
$optionstoRemoveIds = array_map(function($opt) { return $opt->getIdAndChildrenOptionIds(); }, $optionsToRemove);
$optionstoRemoveIds = array_unique($this->flatten($optionstoRemoveIds));
......@@ -302,7 +302,7 @@ class ElementAdminBulkController extends Controller
if ($optionstoAddIds && count($optionstoAddIds) > 0)
{
$optionsToAdd = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:Option')->field('id')->in($optionstoAddIds)->getQuery()->execute()->toArray();
$optionsToAdd = $dm->createQueryBuilder('App\Document\Option')->field('id')->in($optionstoAddIds)->getQuery()->execute()->toArray();
$optionstoAddIds = array_map(function($opt) { return $opt->getIdAndParentOptionIds(); }, $optionsToAdd);
$optionstoAddIds = array_unique($this->flatten($optionstoAddIds));
......
......@@ -72,7 +72,7 @@ class MailTestController extends Controller
$element = $dm->getRepository('App\Document\User')->findOneByEnabled(true);
$element->setLocation('bordeaux');
$element->setGeo(new Coordinates(44.876,-0.512));
$qb = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:Element');
$qb = $dm->createQueryBuilder('App\Document\Element');
$qb->field('status')->gte(ElementStatus::AdminRefused);
$qb->field('moderationState')->notIn(array(ModerationState::GeolocError, ModerationState::NoOptionProvided));
$options = $qb->limit(30)->getQuery()->execute();
......
......@@ -32,7 +32,7 @@ class ConfigurationListener
$removedProps = array_diff($oldPrivateProperties, $newPrivateProperties);
$addedProps = array_diff($newPrivateProperties, $oldPrivateProperties);
$qb = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:Element');
$qb = $dm->createQueryBuilder('App\Document\Element');
$qb = $qb->updateMany();
foreach ($removedProps as $key => $prop) {
$qb = $qb->field('privateData.' . $prop)->rename('data.' . $prop);
......
......@@ -52,7 +52,7 @@ class DatabaseIntegrityWatcher
else if ($document instanceof Webhook)
{
$webhook = $document;
$contributions = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:UserInteractionContribution')
$contributions = $dm->createQueryBuilder('App\Document\UserInteractionContribution')
->field('webhookPosts.webhook.$id')->equals($webhook->getId())
->getQuery()->execute();
......@@ -80,7 +80,7 @@ class DatabaseIntegrityWatcher
$uow->computeChangeSets();
$changeset = $uow->getDocumentChangeSet($document);
if (array_key_exists("name", $changeset)) {
$query = $dm->createQueryBuilder('BiopenGeoDirectoryBundle:Element')->field('optionValues.optionId')->in([$document->getId()]);
$query = $dm->createQueryBuilder('App\Document\Element')->field('optionValues.optionId')->in([$document->getId()]);
$elementIds = array_keys($query->select('id')->hydrate(false)->getQuery()->execute()->toArray());
if (count($elementIds))
{
......
......@@ -14,7 +14,7 @@ class CategoryRepository extends DocumentRepository
{
public function findRootCategories()
{
$qb = $this->createQueryBuilder('BiopenGeoDirectoryBundle:Category');
$qb = $this->createQueryBuilder('App\Document\Category');
$qb->field('isRootCategory')->equals(true)->sort('index', 'asc');
return $qb->getQuery()->execute();
}
......
......@@ -13,7 +13,7 @@ class ConfigurationRepository extends DocumentRepository
{
public function findConfiguration()
{
$qb = $this->createQueryBuilder('BiopenCoreBundle:Configuration');
$qb = $this->createQueryBuilder('App\Document\Configuration');
return $qb->getQuery()->getSingleResult();
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment