public function create($containerOrName, array $data = [])
    {
        // Check if parent or name is defined
        if (!(
            $containerOrName instanceof Model\ContainerInterface ||
            (is_string($containerOrName) && 0 < strlen($containerOrName))
        )
        ) {
            throw new InvalidOperationException("Excepted instance of ContainerInterface or string.");
        }

        // New instance
        $row = $this->editor->getRepository()->createRow();

        // Create default block
        $this->editor->getBlockManager()->create($row);

        // Add to row if available
        if ($containerOrName instanceof Model\ContainerInterface) {
            $count = $containerOrName->getRows()->count();
            $row->setPosition($count);
            $containerOrName->addRow($row);
        } else {
            $row->setName($containerOrName);
        }

        return $row;
    }
public function create($containerOrName, array $data = [])
    {
        // Check if parent or name is defined
        if (!(
            $containerOrName instanceof Model\ContainerInterface ||
            (is_string($containerOrName) && 0 < strlen($containerOrName))
        )
        ) {
            throw new InvalidOperationException("Excepted instance of ContainerInterface or string.");
        }

        // New instance
        $row = $this->editor->getRepository()->createRow();

        // Create default block
        $this->editor->getBlockManager()->create($row);

        // Add to row if available
        if ($containerOrName instanceof Model\ContainerInterface) {
            $count = $containerOrName->getRows()->count();
            $row->setPosition($count);
            $containerOrName->addRow($row);
        } else {
            $row->setName($containerOrName);
        }

        return $row;
    }
public function create ( $ containerOrName , array $ data = [ ] ) { // Check if parent or name is defined if ( ! ( $ containerOrName instanceof Model \ ContainerInterface || ( is_string ( $ containerOrName ) && 0 < strlen ( $ containerOrName ) ) ) ) { throw new InvalidOperationException ( "Excepted instance of ContainerInterface or string." ) ; } // New instance $ row = $ this -> editor -> getRepository ( ) -> createRow ( ) ; // Create default block $ this -> editor -> getBlockManager ( ) -> create ( $ row ) ; // Add to row if available if ( $ containerOrName instanceof Model \ ContainerInterface ) { $ count = $ containerOrName -> getRows ( ) -> count ( ) ; $ row -> setPosition ( $ count ) ; $ containerOrName -> addRow ( $ row ) ; } else { $ row -> setName ( $ containerOrName ) ; } return $ row ; }
Creates a new row.

@param Model\ContainerInterface|string $containerOrName
@param array                           $data

@return Model\RowInterface
@throws InvalidOperationException
Creates a new row .