Refactor moving code to CoreBundle

pull/3262/head
Julio Montoya 5 years ago
parent f4f1d65069
commit 6d855643b2
  1. 1
      config/bundles.php
  2. 2
      src/CoreBundle/Controller/Admin/SettingsController.php
  3. 2
      src/CoreBundle/Controller/EditorController.php
  4. 6
      src/CoreBundle/DependencyInjection/ChamiloCoreExtension.php
  5. 2
      src/CoreBundle/DependencyInjection/Configuration.php
  6. 8
      src/CoreBundle/Entity/CourseRelUser.php
  7. 2
      src/CoreBundle/Entity/Listener/CourseListener.php
  8. 20
      src/CoreBundle/Entity/User.php
  9. 2
      src/CoreBundle/EventListener/LocaleListener.php
  10. 2
      src/CoreBundle/EventListener/LoginSuccessHandler.php
  11. 2
      src/CoreBundle/Framework/Container.php
  12. 4
      src/CoreBundle/Manager/SettingsManager.php
  13. 23
      src/CoreBundle/Resources/config/services.xml
  14. 6
      src/CoreBundle/Resources/config/services.yml
  15. 2
      src/CoreBundle/Settings/CourseSettingsSchema.php
  16. 2
      src/CoreBundle/Settings/DocumentSettingsSchema.php
  17. 2
      src/CoreBundle/Settings/PlatformSettingsSchema.php
  18. 2
      src/CoreBundle/Settings/ProfileSettingsSchema.php
  19. 2
      src/CoreBundle/Settings/RegistrationSettingsSchema.php
  20. 2
      src/CoreBundle/ToolChain.php
  21. 2
      src/CoreBundle/Transformer/ArrayToIdentifierTransformer.php
  22. 5
      src/CoreBundle/Twig/SettingsExtension.php
  23. 4
      src/CoreBundle/Twig/SettingsHelper.php
  24. 2
      src/CourseBundle/Manager/SettingsManager.php
  25. 25
      src/CourseBundle/Resources/config/services.yml
  26. 2
      src/GraphQlBundle/Traits/GraphQLTrait.php
  27. 2
      src/LtiBundle/Util/Utils.php
  28. 14
      src/SettingsBundle/ChamiloSettingsBundle.php
  29. 24
      src/SettingsBundle/DependencyInjection/ChamiloSettingsExtension.php

@ -19,7 +19,6 @@ return [
Chamilo\SkillBundle\ChamiloSkillBundle::class => ['all' => true],
Chamilo\CourseBundle\ChamiloCourseBundle::class => ['all' => true],
Chamilo\TicketBundle\ChamiloTicketBundle::class => ['all' => true],
Chamilo\SettingsBundle\ChamiloSettingsBundle::class => ['all' => true],
Chamilo\GraphQlBundle\ChamiloGraphQlBundle::class => ['all' => true],
Chamilo\LtiBundle\ChamiloLtiBundle::class => ['all' => true],
Sylius\Bundle\SettingsBundle\SyliusSettingsBundle::class => ['all' => true],

@ -4,7 +4,7 @@
namespace Chamilo\CoreBundle\Controller\Admin;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
use Sylius\Bundle\SettingsBundle\Controller\SettingsController as SyliusSettingsController;
use Sylius\Bundle\SettingsBundle\Form\Factory\SettingsFormFactory;

@ -17,7 +17,7 @@ use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
use Chamilo\CoreBundle\Traits\ControllerTrait;
use Chamilo\CoreBundle\Traits\CourseControllerTrait;
use Chamilo\CoreBundle\Traits\ResourceControllerTrait;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use FM\ElfinderBundle\Connector\ElFinderConnector;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

@ -27,6 +27,12 @@ class ChamiloCoreExtension extends Extension
$loader->load('settings.yml');
$loader->load('repositories.yml');
$loader->load('tool_settings.yml');
$loader = new Loader\XmlFileLoader(
$container,
new FileLocator(__DIR__.'/../Resources/config')
);
$loader->load('services.xml');
}
/**

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle\DependencyInjection;
namespace Chamilo\CoreBundle\DependencyInjection;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\ConfigurationInterface;

@ -4,11 +4,17 @@
namespace Chamilo\CoreBundle\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Serializer\Annotation\Groups;
/**
* CourseRelUser.
* @ApiResource(
* shortName="CourseSubscription",
* attributes={"security"="is_granted('ROLE_ADMIN')"},
* normalizationContext={"groups"={"skill:read"}}
* )
*
* @ORM\Table(
* name="course_rel_user",
@ -32,8 +38,6 @@ class CourseRelUser
protected $id;
/**
* Groups({"course_rel_user:read", "course_rel_user:write"}).
*
* @ORM\ManyToOne(targetEntity="Chamilo\CoreBundle\Entity\User", inversedBy="courses", cascade={"persist"})
* @ORM\JoinColumn(name="user_id", referencedColumnName="id")
*/

@ -10,7 +10,7 @@ use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Repository\CourseRepository;
use Chamilo\CoreBundle\ToolChain;
use Chamilo\CourseBundle\Repository\CToolRepository;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Doctrine\ORM\Event\LifecycleEventArgs;
/**

@ -109,17 +109,31 @@ class User implements UserInterface, EquatableInterface
/**
* @var string
* @Groups({"user:read", "user:write"})
* @ORM\Column(name="firstname", type="string", length=60, nullable=true, unique=false)
* @ORM\Column(name="firstname", type="string", length=64, nullable=true, unique=false)
*/
protected $firstname;
/**
* @var string
* @Groups({"user:read", "user:write"})
* @ORM\Column(name="lastname", type="string", length=60, nullable=true, unique=false)
* @ORM\Column(name="lastname", type="string", length=64, nullable=true, unique=false)
*/
protected $lastname;
/**
* @var string
* @Groups({"user:read", "user:write"})
* @ORM\Column(name="website", type="string", length=64, nullable=true)
*/
protected $website;
/**
* @var string
* @Groups({"user:read", "user:write"})
* @ORM\Column(name="biography", type="text", nullable=true)
*/
protected $biography;
/**
* @var string
* @Groups({"user:read", "user:write"})
@ -224,7 +238,7 @@ class User implements UserInterface, EquatableInterface
/**
* @var string
*
* @ORM\Column(name="phone", type="string", length=30, nullable=true, unique=false)
* @ORM\Column(name="phone", type="string", length=64, nullable=true, unique=false)
*/
protected $phone;

@ -5,7 +5,7 @@
namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\RequestEvent;

@ -5,7 +5,7 @@
namespace Chamilo\CoreBundle\EventListener;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Security\Core\Authorization\AuthorizationCheckerInterface;

@ -37,7 +37,7 @@ use Chamilo\CourseBundle\Repository\CStudentPublicationAssignmentRepository;
use Chamilo\CourseBundle\Repository\CStudentPublicationCommentRepository;
use Chamilo\CourseBundle\Repository\CStudentPublicationRepository;
use Chamilo\PageBundle\Entity\Page;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle\Manager;
namespace Chamilo\CoreBundle\Manager;
use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\Course;
@ -67,7 +67,7 @@ class SettingsManager implements SettingsManagerInterface
ServiceRegistryInterface $schemaRegistry,
EntityManager $manager,
EntityRepository $repository,
$eventDispatcher,
EventDispatcherInterface $eventDispatcher,
RequestStack $request
) {
$this->schemaRegistry = $schemaRegistry;

@ -5,11 +5,10 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="chamilo_settings.settings.manager.class">Chamilo\SettingsBundle\Manager\SettingsManager</parameter>
<parameter key="chamilo_settings.repository.parameter.class">Chamilo\CoreBundle\Entity\Manager\SettingsCurrentManager</parameter>
<parameter key="chamilo_settings.settings.manager.class">Chamilo\CoreBundle\Manager\SettingsManager</parameter>
<parameter key="chamilo_settings.repository.parameter.entity.class">Chamilo\CoreBundle\Entity\SettingsCurrent</parameter>
<parameter key="chamilo_settings.twig.extension.settings.class">Chamilo\SettingsBundle\Twig\SettingsExtension</parameter>
<parameter key="chamilo_settings.templating.helper.settings.class">Chamilo\SettingsBundle\Templating\Helper\SettingsHelper</parameter>
<parameter key="chamilo_settings.twig.extension.settings.class">Chamilo\CoreBundle\Twig\SettingsExtension</parameter>
<parameter key="chamilo_settings.templating.helper.settings.class">Chamilo\CoreBundle\Twig\SettingsHelper</parameter>
</parameters>
<services>
@ -37,14 +36,14 @@
<service id="Sylius\Bundle\SettingsBundle\Form\Factory\SettingsFormFactory" alias="chamilo_settings.form_factory.settings">
</service>
<service id="chamilo_settings.templating.helper.settings" class="%chamilo_settings.templating.helper.settings.class%" public="true">
<argument type="service" id="chamilo.settings.manager" />
<tag name="templating.helper" alias="chamilo_settings" />
</service>
<!-- <service id="chamilo_settings.templating.helper.settings" class="%chamilo_settings.templating.helper.settings.class%" public="true">-->
<!-- <argument type="service" id="chamilo.settings.manager" />-->
<!-- <tag name="templating.helper" alias="chamilo_settings" />-->
<!-- </service>-->
<service id="chamilo.twig.extension.settings" class="%chamilo_settings.twig.extension.settings.class%" public="false">
<argument type="service" id="chamilo_settings.templating.helper.settings" />
<tag name="twig.extension" />
</service>
<!-- <service id="chamilo.twig.extension.settings" class="%chamilo_settings.twig.extension.settings.class%" public="false">-->
<!-- <argument type="service" id="chamilo_settings.templating.helper.settings" />-->
<!-- <tag name="twig.extension" />-->
<!-- </service>-->
</services>
</container>

@ -250,6 +250,12 @@ services:
class: Chamilo\CoreBundle\EventListener\LogoutSuccessHandler
arguments: ['@router', '@security.authorization_checker', '@security.token_storage']
Chamilo\CoreBundle\Twig\SettingsHelper:
arguments:
- '@chamilo.settings.manager'
tags:
- {name: templating.helper, alias: chamilo_settings}
# Block services
# chamilo_core.block.course:
# class: Chamilo\CoreBundle\Block\CourseBlockService

@ -9,7 +9,7 @@ use Chamilo\CoreBundle\Form\DataTransformer\ResourceToIdentifierTransformer;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Chamilo\CoreBundle\Tool\AbstractTool;
use Chamilo\CoreBundle\ToolChain;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Chamilo\CoreBundle\Transformer\ArrayToIdentifierTransformer;
//use Sylius\Bundle\ResourceBundle\Form\DataTransformer\ResourceToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;

@ -5,7 +5,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Chamilo\CoreBundle\Transformer\ArrayToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;

@ -5,7 +5,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Chamilo\CoreBundle\Transformer\ArrayToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\TimezoneType;

@ -5,7 +5,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Chamilo\CoreBundle\Transformer\ArrayToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;

@ -5,7 +5,7 @@
namespace Chamilo\CoreBundle\Settings;
use Chamilo\CoreBundle\Form\Type\YesNoType;
use Chamilo\SettingsBundle\Transformer\ArrayToIdentifierTransformer;
use Chamilo\CoreBundle\Transformer\ArrayToIdentifierTransformer;
use Sylius\Bundle\SettingsBundle\Schema\AbstractSettingsBuilder;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;

@ -13,7 +13,7 @@ use Chamilo\CoreBundle\Security\Authorization\Voter\ResourceNodeVoter;
use Chamilo\CoreBundle\Tool\AbstractTool;
use Chamilo\CourseBundle\Entity\CTool;
use Chamilo\CourseBundle\Repository\CToolRepository;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Doctrine\ORM\EntityManagerInterface;
use Symfony\Component\PropertyAccess\Exception\InvalidArgumentException;
use Symfony\Component\Security\Core\Security;

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle\Transformer;
namespace Chamilo\CoreBundle\Transformer;
use Symfony\Component\Form\DataTransformerInterface;

@ -2,9 +2,8 @@
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle\Twig;
namespace Chamilo\CoreBundle\Twig;
use Chamilo\SettingsBundle\Templating\Helper\SettingsHelper;
use Twig\Extension\AbstractExtension;
use Twig\TwigFilter;
use Twig\TwigFunction;
@ -24,7 +23,7 @@ class SettingsExtension extends AbstractExtension
/**
* @param SettingsHelper $helper
*/
public function __construct($helper)
public function __construct(SettingsHelper $helper)
{
$this->helper = $helper;
}

@ -2,9 +2,9 @@
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle\Templating\Helper;
namespace Chamilo\CoreBundle\Twig;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Sylius\Bundle\SettingsBundle\Manager\SettingsManagerInterface;
use Sylius\Bundle\SettingsBundle\Templating\Helper\SettingsHelperInterface;
use Symfony\Component\Templating\Helper\Helper;

@ -7,7 +7,7 @@ namespace Chamilo\CourseBundle\Manager;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\SettingsCurrent;
use Chamilo\CourseBundle\Entity\CCourseSetting;
use Chamilo\SettingsBundle\Manager\SettingsManager as ChamiloSettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager as ChamiloSettingsManager;
use Sylius\Bundle\SettingsBundle\Model\Settings;
use Sylius\Bundle\SettingsBundle\Model\SettingsInterface;
use Sylius\Bundle\SettingsBundle\Schema\SchemaInterface;

@ -28,31 +28,6 @@ services:
chamilo_course.repository.parameter:
class: Chamilo\CourseBundle\Repository\CCourseSettingRepository
# chamilo_settings.repository.parameter:
# class: Chamilo\CoreBundle\Repository\SettingsCurrentRepository
# factory: ["@doctrine", getRepository]
# arguments: [ Chamilo\CoreBundle\Entity\SettingsCurrent ]
# chamilo_course.settings.manager:
# class: '%chamilo_course.settings.manager.class%'
# arguments:
# - '@chamilo_course.registry.settings_schema'
# - '@sylius.registry.settings_resolver'
# - '@doctrine.orm.entity_manager'
# - '@chamilo_course.repository.parameter'
# - '@sylius.factory.settings'
# - '@event_dispatcher'
# chamilo_course.settings.manager:
# class: '%chamilo_course.settings.manager.class%'
# public: true
# arguments:
# - '@sylius.registry.settings_schema'
# - '@sylius.registry.settings_resolver'
# - '@doctrine.orm.entity_manager'
# - '@chamilo_course.repository.parameter'
# - '@sylius.factory.settings'
# - '@event_dispatcher'
Chamilo\CourseBundle\Repository\:
resource: ../../Repository
exclude: '../../Repository/{CDocumentRepository.php|CQuizRepository.php}'

@ -8,7 +8,7 @@ use Chamilo\CoreBundle\Entity\AccessUrl;
use Chamilo\CoreBundle\Entity\Course;
use Chamilo\CoreBundle\Entity\Session;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
use Doctrine\ORM\EntityManager;
use Firebase\JWT\JWT;
use Overblog\GraphQLBundle\Error\UserError;

@ -6,7 +6,7 @@ namespace Chamilo\LtiBundle\Util;
use Chamilo\CoreBundle\Entity\User;
use Chamilo\LtiBundle\Entity\ExternalTool;
use Chamilo\SettingsBundle\Manager\SettingsManager;
use Chamilo\CoreBundle\Manager\SettingsManager;
/**
* Class Utils.

@ -1,14 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
/**
* Class ChamiloSettingsBundle.
*/
class ChamiloSettingsBundle extends Bundle
{
}

@ -1,24 +0,0 @@
<?php
/* For licensing terms, see /license.txt */
namespace Chamilo\SettingsBundle\DependencyInjection;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
/**
* This is the class that loads and manages your bundle configuration.
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class ChamiloSettingsExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new Loader\XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('services.xml');
}
}
Loading…
Cancel
Save