Skip to content

Commit

Permalink
Merge pull request FriendsOfSymfony#425 from Remixjobs/cv-files-check…
Browse files Browse the repository at this point in the history
…-corrupted-disable-all-filters

[cv-files] disable all filters while checink on corruption.
  • Loading branch information
jeremymarc committed Oct 11, 2013
2 parents 4a99200 + a9179c4 commit 3986a7d
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions src/Rj/CoreBundle/Command/FindCorruptedCvFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
namespace Rj\CoreBundle\Command;

use Doctrine\ORM\Query\FilterCollection;
use Rj\CoreBundle\DomainCommand\FindLastCompanyCommand;
use Symfony\Bridge\Doctrine\RegistryInterface;
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

use Rj\CoreBundle\DomainCommand\CalculateYearsExperienceCommand;

class FindCorruptedCvFilesCommand extends ContainerAwareCommand
{
/**
Expand All @@ -29,7 +26,11 @@ protected function configure()
*/
public function execute(InputInterface $input, OutputInterface $output)
{
$this->disableFilterSafely('softdeleteable', $this->getContainer()->get('doctrine')->getManager()->getFilters());
/** @var FilterCollection $filterCollection */
$filterCollection = $this->getDoctrine()->getManager()->getFilters();
foreach ($filterCollection->getEnabledFilters() as $name => $filter) {
$filterCollection->disable($name);
}

$projectDir = realpath($this->getContainer()->getParameter('kernel.root_dir').'/../');

Expand Down Expand Up @@ -67,13 +68,6 @@ public function execute(InputInterface $input, OutputInterface $output)
$firstResult += $maxResults;
}
}

protected function disableFilterSafely($name, FilterCollection $filterCollection)
{
if (array_key_exists($name, $filterCollection->getEnabledFilters())) {
$filterCollection->disable($name);
}
}

/**
* @return \Rj\CoreBundle\Entity\CvFileRepository
Expand Down

0 comments on commit 3986a7d

Please sign in to comment.