src/View/Cell/DblistCell.php
public function renderValue(string $value, string $list) : void
    {
        /**
         * @var \CsvMigrations\Model\Table\DblistsTable
         */
        $table = $this->loadModel('CsvMigrations.Dblists');
        $this->_createList($list);

        $query = $table->find()
            ->enableHydration(true)
            ->where([$table->aliasField('name') => $list])
            ->matching('DblistItems', function ($q) use ($value) {
                return $q->where(['DblistItems.value' => $value]);
            });

        try {
            $entity = $query->firstOrFail();
        } catch (RecordNotFoundException $e) {
            $this->set('data', '' !== trim($value) ? sprintf(ListRenderer::VALUE_NOT_FOUND_HTML, $value) : '');

            return;
        }

        Assert::isInstanceOf($entity, EntityInterface::class);
        $this->set('data', $entity->get('_matchingData')['DblistItems']->get('name'));
    }
public function renderValue(string $value, string $list) : void
    {
        /**
         * @var \CsvMigrations\Model\Table\DblistsTable
         */
        $table = $this->loadModel('CsvMigrations.Dblists');
        $this->_createList($list);

        $query = $table->find()
            ->enableHydration(true)
            ->where([$table->aliasField('name') => $list])
            ->matching('DblistItems', function ($q) use ($value) {
                return $q->where(['DblistItems.value' => $value]);
            });

        try {
            $entity = $query->firstOrFail();
        } catch (RecordNotFoundException $e) {
            $this->set('data', '' !== trim($value) ? sprintf(ListRenderer::VALUE_NOT_FOUND_HTML, $value) : '');

            return;
        }

        Assert::isInstanceOf($entity, EntityInterface::class);
        $this->set('data', $entity->get('_matchingData')['DblistItems']->get('name'));
    }
public function renderValue ( string $ value , string $ list ) : void { /**
         * @var \CsvMigrations\Model\Table\DblistsTable
         */ $ table = $ this -> loadModel ( 'CsvMigrations.Dblists' ) ; $ this -> _createList ( $ list ) ; $ query = $ table -> find ( ) -> enableHydration ( true ) -> where ( [ $ table -> aliasField ( 'name' ) => $ list ] ) -> matching ( 'DblistItems' , function ( $ q ) use ( $ value ) { return $ q -> where ( [ 'DblistItems.value' => $ value ] ) ; } ) ; try { $ entity = $ query -> firstOrFail ( ) ; } catch ( RecordNotFoundException $ e ) { $ this -> set ( 'data' , '' !== trim ( $ value ) ? sprintf ( ListRenderer :: VALUE_NOT_FOUND_HTML , $ value ) : '' ) ; return ; } Assert :: isInstanceOf ( $ entity , EntityInterface :: class ) ; $ this -> set ( 'data' , $ entity -> get ( '_matchingData' ) [ 'DblistItems' ] -> get ( 'name' ) ) ; }
Match and render the sucessfull value.

Checks the given list if it has the given value in its list items.

@param string $value List item value
@param string $list Name of the list
@return void
Match and render the sucessfull value .