Class 'BlockController' not found

Permalink
Hello
I have a problem during migration from c5.6 to c5.7: after adding a custom block (build in Designer Content in c56 with some fields: text area, image, file etc.) to a new instance of concrete 5.7 in Block Type area I have an error:
Class 'BlockController' not found
I'm not very good in developing so I need your advise: how can I easly convert old block to the new Concrete5?

 
MrKDilkington replied on at Permalink Reply
MrKDilkington
Hi tzmudzinski,

You are getting the error because of a namespace issue.

Here is a tutorial example on updating a block to 5.7.
http://www.codeblog.ch/2014/09/concrete5-7-upgrade-packages/...

If programming is an issue, there is a 5.7 equivalent to Designer Content called Block Designer.
http://www.concrete5.org/marketplace/addons/block-designer...
tzmudzinski replied on at Permalink Reply
Hi!
Thank you very much for you reply. But still I have some issues.
I made everything step by step.
Finally the block shown in Add Functionality but without name (only version)
also I can install it but after that nothing happend.
I can't find Block in block folder. Below is code of my controller.php:

<?php
namespace Concrete\Package\test;
defined('C5_EXECUTE') or die('Access Denied.');
class Controller extends \Concrete\Core\Package\Package {
    protected $pkgHandle = 'test';
    protected $appVersionRequired = '5.7.0';
    protected $pkgVersion = '2.0.0'; 
   protected $btDescription = 'testDescript';
   protected $btTable = 'btDCTest';
   protected $btInterfaceWidth = "700";
   protected $btInterfaceHeight = "450";
   protected $btCacheBlockRecord = true;
   protected $btCacheBlockOutput = true;
   protected $btCacheBlockOutputOnPost = true;
   protected $btCacheBlockOutputForRegisteredUsers = false;
MrKDilkington replied on at Permalink Reply
MrKDilkington
It looks like you are blending your block and package together into one.

I recommend you read through the developer documentation.
http://www.concrete5.org/documentation/developers/5.7/working-with-...
tzmudzinski replied on at Permalink Reply
Unfortunately after adding this functions under
class Controller extends \Concrete\Core\Package\Package {

nothing changes.
MichaelG replied on at Permalink Reply 1 Attachment
MichaelG
as MrKDilkington said - you've got block code mixed into your package controller.

Packages does not equate to a block. A package can contain any number of things including blocks, themes, models, controllers.

you should have a structure that resembles

/packages/my_package/
/packages/my_package/controller.php
/packages/my_package/blocks/my_block/
/packages/my_package/blocks/my_block/controller.php

the package controller handles installing the blocks etc

Here's something though, you don't always NEED a package. If your goal is just to make a simple block for a website. Make that block, and put it in /application/blocks/

Unzip this basic_block I have attached into /application/blocks and see how playing around with it works for you
tzmudzinski replied on at Permalink Reply
Thank you!

Now I understand the problem and I installed the block.
I also add line
use \Concrete\Core\File\File;
- link to file works perfectly.
But I have one small issue with image - I have an error:

Class 'Application\Block\Testb\stdClass' not found