On add new item.

@param \AnimeDb\Bundle\CatalogBundle\Event\Storage\AddNewItem $event
330311
public function onAddNewItem(AddNewItem $event)
    {
        $item = $event->getItem();
        if (!$event->getFillers()->contains($this->filler) && ($url = $this->refiller->getSourceForFill($item))) {
            $new_item = $this->filler->fill(['url' => $url]);

            // fill item
            if (!$item->getCountry()) {
                $item->setCountry($new_item->getCountry());
            }
            if (!$item->getDateEnd()) {
                $item->setDateEnd($new_item->getDateEnd());
            }
            if (!$item->getDatePremiere()) {
                $item->setDatePremiere($new_item->getDatePremiere());
            }
            if (!$item->getDuration()) {
                $item->setDuration($new_item->getDuration());
            }
            if (!$item->getEpisodes()) {
                $item->setEpisodes($new_item->getEpisodes());
            }
            if (!$item->getEpisodesNumber()) {
                $item->setEpisodesNumber($new_item->getEpisodesNumber());
            }
            if (!$item->getFileInfo()) {
                $item->setFileInfo($new_item->getFileInfo());
            }
            if (!$item->getSummary()) {
                $item->setSummary($new_item->getSummary());
            }
            if (!$item->getStudio()) {
                $item->setStudio($new_item->getStudio());
            }
            if (!$item->getType()) {
                $item->setType($new_item->getType());
            }
            // remove links
            $item->getCountry()->removeItem($new_item);
            $item->getType()->removeItem($new_item);
            $item->getStudio()->removeItem($new_item);

            if (!$item->getCover()) {
                $item->setCover($new_item->getCover());
            }
            foreach ($new_item->getGenres() as $genre) {
                $item->addGenre($genre->removeItem($new_item));
            }
            // 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->setItem(null));
            }
            foreach ($new_item->getSources() as $source) {
                $item->addSource($source->setItem(null));
            }

            $event->addFiller($this->filler);
            // resend event
            $this->dispatcher->dispatch(StoreEvents::ADD_NEW_ITEM, clone $event);
            $event->stopPropagation();
        }
    }
1134181
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;
    }
386910
function &addItem($content, $name = null) {
        if (!$name) {
            $name = uniqid(microtime(true), true);
        }
        $this->items[$name] = new Li($content);
        return $this->items[$name];
    }
1266530
public function addItem($item, $attribs = [])
    {
        if (!$item instanceof ListItem) {
            $item = new ListItem($item, $attribs);
        }

        $this->content[] = $item;

        return $this;
    }
1309332
public function addEvent(Event $event)
    {
        $expectedSequenceNumber = $this->nextSequenceNumber();
        if ($expectedSequenceNumber !== $event->sequenceNumber()) {
            throw new \RuntimeException('Corrupted sequence number.');
        }

        $this->events[] = $this->applyRegistrationCallbacks($event);
    }
415850
public function addItem(Item $item)
    {
        if (!$this->items->contains($item)) {
            $this->items->add($item);
            $item->setStudio($this);
        }

        return $this;
    }
883579
def add_event(self, event):
        
        self._events.append(event)
        self._events_by_name[event.get_name] = event
326787
public void addNewItems(List<M> newItems) {
    if (this.items == null) {
      this.items = createEmptyList();
    }

    this.items.addAll(newItems);
  }
900768
public function addItem(array $item, $first=false, $createGroup=false)
	{
		$this->addItemToTarget($this->arrButtons, $item, $first, $createGroup);
	}
791988
public function onMenuConfigure(ConfigureMenuEvent $event)
    {
        if (!$this->permissionResolver->hasAccess('uicron', 'list')) {
            return;
        }

        $menu = $event->getMenu();

        $cronsMenu = $menu->getChild(MainMenuBuilder::ITEM_ADMIN);
        $cronsMenu->addChild(self::ITEM_CRONS, ['route' => 'edgar.ezuicron.list']);
    }
688539
public function addEvent(EventEntity $event)
    {
        if (!$this->events->contains($event)) {
            $this->events[] = $event;
        }
        
        return $this;
    }
375158
public function add($event) {
        $event->setParent($this->_parent);
        $this->_events[$event->getName()] = $event;
    }
931932
public function add($data)
  {
      if (is_array($data)) {
          $this->listeners = array_merge($this->listeners, $data);
      } elseif ($data instanceof \Symfony\Component\EventDispatcher\EventlistenerInterface) {
          if (!in_array(get_class($data), $this->loaded)) {
              $this->emitter->addListener($data);
              $this->loaded[] = get_class($data);
          }
      } else {
          if (is_string($data)) {
              $this->listeners[] = $data;
          }
      }
  }
478830
public function add_new_item($title='') {
        $nitem = new cc_item();
        $nitem->title = $title;
        $this->add_item($nitem);
        return $nitem;
    }
193663
public function addEvent($event) {
		$result = add_entity_relationship($event->guid, self::EVENT_CALENDAR_RELATIONSHIP, $this->guid);

		if ($result) {
			// allow events to fire after confirmation that it has been added to the calendar
			elgg_trigger_event('events_api', 'add_to_calendar', array('event' => $event, 'calendar' => $this));
		}
		return $result;
	}
569677
public function addEvent(EventMessage $event)
    {
        $this->events[] = $event;
        if (stristr($event->getEventList(), 'complete') !== false
            || stristr($event->getName(), 'complete') !== false
            || stristr($event->getName(), 'DBGetResponse') !== false
        ) {
            $this->completed = true;
        }
    }
1015274
protected function create(Event $event)
    {
        $this->dispatch(static::EVENT_CREATE_BEFORE, $event);
        if (!$event->isPropagationStopped()) {
            $this->createProcess($event);
            if (!$event->isPropagationStopped()) {
                $this->dispatch(static::EVENT_CREATE_AFTER, $event);
            }
        }
    }