Size: a a a

2019 December 23

МЛ

Мирослав Ли in Drupal RU
Comrade Gagarin
объявить мало, надо его реализовать в классе
источник

МЛ

Мирослав Ли in Drupal RU
и  это не работает
источник

C

Comrade Gagarin in Drupal RU
"не работает" как выглядит?
источник

МЛ

Мирослав Ли in Drupal RU
Comrade Gagarin
"не работает" как выглядит?
ArgumentCountError: Too few arguments to function 3 passed exactly 5 expected
источник

C

Comrade Gagarin in Drupal RU
установи дефолтные значения для двух лишних параметров в __construct
источник

МЛ

Мирослав Ли in Drupal RU
Comrade Gagarin
установи дефолтные значения для двух лишних параметров в __construct
это же сервисы, какие могут быть значения по умолчанию?
источник

C

Comrade Gagarin in Drupal RU
NULL
источник

МЛ

Мирослав Ли in Drupal RU
теперь ругается на исползование методов, этих объкетов и понятно почему
источник

МЛ

Мирослав Ли in Drupal RU
не прокинулись зависимости
источник

C

Comrade Gagarin in Drupal RU
"ругается" как выглядит?
источник

МЛ

Мирослав Ли in Drupal RU
Comrade Gagarin
"ругается" как выглядит?
Call to a member function getStorage() on null
источник

C

Comrade Gagarin in Drupal RU
код в студию
источник

МЛ

Мирослав Ли in Drupal RU
Comrade Gagarin
код в студию
abstract class CustomCSVImportPluginBase extends PluginBase implements CustomCSVImportPluginInterface, ContainerFactoryPluginInterface {

 /**
  * @var \Drupal\Core\Entity\EntityTypeManagerInterface
  */
 protected $entityTypeManager;

 /**
  * @var \Drupal\Core\File\FileSystemInterface
  */
 protected $fileSystem;

 /**
  * {@inheritdoc}
  */
 public function __construct(array $configuration, $plugin_id, $plugin_definition, EntityTypeManagerInterface $entity_type_manager = NULL, FileSystemInterface $file_system = NULL) {
   parent::__construct($configuration, $plugin_id, $plugin_definition);

   $this->entityTypeManager = $entity_type_manager;
   $this->fileSystem = $file_system;
 }

 /**
  * {@inheritdoc}
  */
 public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
   return new static(
     $configuration,
     $plugin_id,
     $plugin_definition,
     $container->get('entity_type.manager'),
     $container->get('file_system')
   );
 }
источник

C

Comrade Gagarin in Drupal RU
А вызываешь где и как?
источник

МЛ

Мирослав Ли in Drupal RU
есть метода, в котором есть код $this->entityTypeManager->getStorage('taxonomy_term');
источник

C

Comrade Gagarin in Drupal RU
метод где?
источник

МЛ

Мирослав Ли in Drupal RU
/**
  * Load for edit or create new entity by unique id from CSV.
  *
  * @param $id
  *   Unique ID in CSV file.
  * @param $entity_type
  *   The entity type id.
  * @param $bundle
  *   The bundle of entity type.
  * @param $field_id
  *   Proxy field`s name of unique id from CSV for edit.
  *
  * @return \Drupal\Core\Entity\EntityInterface|null
  *
  * @throws \Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
  * @throws \Drupal\Component\Plugin\Exception\PluginNotFoundException
  */
 protected function getContentEntityByUid($id, $entity_type, $bundle, $field_id) {
   $storage = $this->entityTypeManager->getStorage($entity_type);
   $bundle_name = $this->getContentBundleName();

   $eid = $storage->getQuery()
     ->condition($bundle_name, $bundle)
     ->condition($field_id, $id)
     ->execute();

   if (!empty($eid)) {
     $entity = $storage->load($eid[key($eid)]);
   }
   else {
     $entity = $storage->create([
       $bundle_name => $bundle,
       'langcode' => 'en',
       'uid' => 1,
       'status' => 1,
     ]);

     $entity->set($field_id, $id);
   }

   return $entity;
 }
источник

C

Comrade Gagarin in Drupal RU
где этот метод находится?
источник

МЛ

Мирослав Ли in Drupal RU
Comrade Gagarin
где этот метод находится?
в этом же классе
источник

МЛ

Мирослав Ли in Drupal RU
в абстрактном
источник