src/Service/Refiller.php
protected function fillItem(Item $item, Item $new_item, $field)
    {
        switch ($field) {
            case self::FIELD_COUNTRY:
                $item->setCountry($new_item->getCountry());
                break;
            case self::FIELD_DATE_END:
                $item->setDateEnd($new_item->getDateEnd());
                break;
            case self::FIELD_DATE_PREMIERE:
                $item->setDatePremiere($new_item->getDatePremiere());
                break;
            case self::FIELD_DURATION:
                $item->setDuration($new_item->getDuration());
                break;
            case self::FIELD_EPISODES:
                $item->setEpisodes($new_item->getEpisodes());
                break;
            case self::FIELD_EPISODES_NUMBER:
                $item->setEpisodesNumber($new_item->getEpisodesNumber());
                break;
            case self::FIELD_FILE_INFO:
                $item->setFileInfo($new_item->getFileInfo());
                break;
            case self::FIELD_GENRES:
                /* @var $new_genre \AnimeDb\Bundle\CatalogBundle\Entity\Genre */
                foreach ($new_item->getGenres() as $new_genre) {
                    $item->addGenre($new_genre);
                }
                break;
            case self::FIELD_NAMES:
                // set main name in top of names list
                $new_names = $new_item->getNames()->toArray();
                array_unshift($new_names, (new Name())->setName($new_item->getName()));
                foreach ($new_names as $new_name) {
                    $item->addName($new_name);
                }
                break;
            case self::FIELD_SOURCES:
                foreach ($new_item->getSources() as $new_source) {
                    $item->addSource($new_source);
                }
                break;
            case self::FIELD_STUDIO:
                $item->setStudio($new_item->getStudio());
                break;
            case self::FIELD_SUMMARY:
                $item->setSummary($new_item->getSummary());
                break;
        }

        return $item;
    }
protected function fillItem(Item $item, Item $new_item, $field)
    {
        switch ($field) {
            case self::FIELD_COUNTRY:
                $item->setCountry($new_item->getCountry());
                break;
            case self::FIELD_DATE_END:
                $item->setDateEnd($new_item->getDateEnd());
                break;
            case self::FIELD_DATE_PREMIERE:
                $item->setDatePremiere($new_item->getDatePremiere());
                break;
            case self::FIELD_DURATION:
                $item->setDuration($new_item->getDuration());
                break;
            case self::FIELD_EPISODES:
                $item->setEpisodes($new_item->getEpisodes());
                break;
            case self::FIELD_EPISODES_NUMBER:
                $item->setEpisodesNumber($new_item->getEpisodesNumber());
                break;
            case self::FIELD_FILE_INFO:
                $item->setFileInfo($new_item->getFileInfo());
                break;
            case self::FIELD_GENRES:
                /* @var $new_genre \AnimeDb\Bundle\CatalogBundle\Entity\Genre */
                foreach ($new_item->getGenres() as $new_genre) {
                    $item->addGenre($new_genre);
                }
                break;
            case self::FIELD_NAMES:
                // set main name in top of names list
                $new_names = $new_item->getNames()->toArray();
                array_unshift($new_names, (new Name())->setName($new_item->getName()));
                foreach ($new_names as $new_name) {
                    $item->addName($new_name);
                }
                break;
            case self::FIELD_SOURCES:
                foreach ($new_item->getSources() as $new_source) {
                    $item->addSource($new_source);
                }
                break;
            case self::FIELD_STUDIO:
                $item->setStudio($new_item->getStudio());
                break;
            case self::FIELD_SUMMARY:
                $item->setSummary($new_item->getSummary());
                break;
        }

        return $item;
    }
protected function fillItem ( Item $ item , Item $ new_item , $ field ) { switch ( $ field ) { case self :: FIELD_COUNTRY : $ item -> setCountry ( $ new_item -> getCountry ( ) ) ; break ; case self :: FIELD_DATE_END : $ item -> setDateEnd ( $ new_item -> getDateEnd ( ) ) ; break ; case self :: FIELD_DATE_PREMIERE : $ item -> setDatePremiere ( $ new_item -> getDatePremiere ( ) ) ; break ; case self :: FIELD_DURATION : $ item -> setDuration ( $ new_item -> getDuration ( ) ) ; break ; case self :: FIELD_EPISODES : $ item -> setEpisodes ( $ new_item -> getEpisodes ( ) ) ; break ; case self :: FIELD_EPISODES_NUMBER : $ item -> setEpisodesNumber ( $ new_item -> getEpisodesNumber ( ) ) ; break ; case self :: FIELD_FILE_INFO : $ item -> setFileInfo ( $ new_item -> getFileInfo ( ) ) ; break ; case self :: FIELD_GENRES : /* @var $new_genre \AnimeDb\Bundle\CatalogBundle\Entity\Genre */ foreach ( $ new_item -> getGenres ( ) as $ new_genre ) { $ item -> addGenre ( $ new_genre ) ; } break ; case self :: FIELD_NAMES : // set main name in top of names list $ new_names = $ new_item -> getNames ( ) -> toArray ( ) ; array_unshift ( $ new_names , ( new Name ( ) ) -> setName ( $ new_item -> getName ( ) ) ) ; foreach ( $ new_names as $ new_name ) { $ item -> addName ( $ new_name ) ; } break ; case self :: FIELD_SOURCES : foreach ( $ new_item -> getSources ( ) as $ new_source ) { $ item -> addSource ( $ new_source ) ; } break ; case self :: FIELD_STUDIO : $ item -> setStudio ( $ new_item -> getStudio ( ) ) ; break ; case self :: FIELD_SUMMARY : $ item -> setSummary ( $ new_item -> getSummary ( ) ) ; break ; } return $ item ; }
Fill item.

@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $item
@param \AnimeDb\Bundle\CatalogBundle\Entity\Item $new_item
@param string                                    $field

@return \AnimeDb\Bundle\CatalogBundle\Entity\Item
Fill item .