Fix LoadLanguages fixture. Language entity refactored.

This commit is contained in:
Alexey Skobkin 2019-01-19 21:45:22 +03:00
parent d1e7b360e9
commit a5af1ac1f7
2 changed files with 12 additions and 64 deletions

View File

@ -78,13 +78,13 @@ class LoadLanguages implements FixtureInterface, ContainerAwareInterface
foreach ($finder as $file) { foreach ($finder as $file) {
$output->writeln($file->getRelativePathname() . ' found. Parsing...'); $output->writeln($file->getRelativePathname() . ' found. Parsing...');
include $geshiPath . DIRECTORY_SEPARATOR .$file->getRelativePathname(); include $geshiPath.DIRECTORY_SEPARATOR.$file->getRelativePathname();
$language = new Language(); $language = new Language();
$language $language
->setName($language_data['LANG_NAME']) ->setName($language_data['LANG_NAME'])
->setCode(basename($file->getRelativePathname(), '.php')) ->setCode(basename($file->getRelativePathname(), '.php'))
->setEnabled(true) ->setIsEnabled(true)
; ;
$output->write('---> "' . $language->getName() . '"'); $output->write('---> "' . $language->getName() . '"');

View File

@ -5,8 +5,6 @@ namespace Skobkin\Bundle\CopyPasteBundle\Entity;
use Doctrine\ORM\Mapping as ORM; use Doctrine\ORM\Mapping as ORM;
/** /**
* Language
*
* @ORM\Table(name="languages", indexes={ * @ORM\Table(name="languages", indexes={
* @ORM\Index(name="idx_enabled", columns={"is_enabled"}), * @ORM\Index(name="idx_enabled", columns={"is_enabled"}),
* @ORM\Index(name="idx_preferred", columns={"is_preferred"}), * @ORM\Index(name="idx_preferred", columns={"is_preferred"}),
@ -53,14 +51,7 @@ class Language
*/ */
private $isEnabled; private $isEnabled;
public function getId(): int
/**
* Get id
*
* @return integer
*/
public function getId()
{ {
return $this->id; return $this->id;
} }
@ -70,91 +61,48 @@ class Language
return $this->name; return $this->name;
} }
/** public function setName(string $name): self
* Set name
*
* @param string $name
* @return Lang
*/
public function setName($name)
{ {
$this->name = $name; $this->name = $name;
return $this; return $this;
} }
/** public function getName(): string
* Get name
*
* @return string
*/
public function getName()
{ {
return $this->name; return $this->name;
} }
/** public function setCode($code): self
* Set code
*
* @param string $code
* @return Lang
*/
public function setCode($code)
{ {
$this->code = $code; $this->code = $code;
return $this; return $this;
} }
/** public function getCode(): string
* Get code
*
* @return string
*/
public function getCode()
{ {
return $this->code; return $this->code;
} }
/** public function setIsEnabled($isEnabled): self
* Set isEnabled
*
* @param boolean $isEnabled
* @return Lang
*/
public function setIsEnabled($isEnabled)
{ {
$this->isEnabled = $isEnabled; $this->isEnabled = $isEnabled;
return $this; return $this;
} }
/** public function getIsEnabled(): bool
* Get isEnabled
*
* @return boolean
*/
public function getIsEnabled()
{ {
return $this->isEnabled; return $this->isEnabled;
} }
/** function getIsPreferred(): bool
* Get isPreferred
*
* @return boolean
*/
function getIsPreferred()
{ {
return $this->isPreferred; return $this->isPreferred;
} }
/** function setIsPreferred(bool $isPreferred): self
* Set isPreferred
*
* @param boolean $isPreferred
*/
function setIsPreferred($isPreferred)
{ {
$this->isPreferred = $isPreferred; $this->isPreferred = $isPreferred;