Upgrade Problem 2

Permalink
Hi,

I found another problem.

With this code
$pageType = \CollectionType::getByHandle('home');
      if(!is_object($pageType)) {
         $data['ctHandle'] = 'home';
         $data['ctName'] = t('Home');
         $newPage = \CollectionType::add($data, $pkg);
      }


I am getting

Class 'CollectionType' not found


I have grepped the source of 8.3 and can't find "CollectionType". What is the proper way to do this in 8.3?

gwardell
 
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Try 'CollectionType' instead of 'CollectilonType'
gwardell replied on at Permalink Reply
gwardell
Sorry, now I feel a bit dumb.

I thought I copied and pasted.

Ok, there was only the first instance that was spelled like that. I changed the spelling and now I still get the error.
ConcreteOwl replied on at Permalink Reply
ConcreteOwl
Try replacing \CollectionType with \PageType
gwardell replied on at Permalink Reply
gwardell
That seems a little better.

Now I am getting this:

An exception occurred while executing 'insert into PageTypes (ptName, ptHandle, ptDefaultPageTemplateID, ptAllowedPageTemplates, ptIsInternal, ptLaunchInComposer, ptDisplayOrder, ptIsFrequentlyAdded, siteTypeID, pkgID) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params [null, null, 0, "A", 0, 0, "1", 0, 1, 12]: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'ptName' cannot be null

I tried changing ctName to ptName, and to Name, and neither helped.
gwardell replied on at Permalink Reply
gwardell
Hi,

I just changed it to name instead of Name. And that got around this.
gwardell replied on at Permalink Reply
gwardell
Now I get

Class 'AttributeKeyCategory' not found


$att_coll = \AttributeKeyCategory::getByHandle('collection');


And I will probably also need

$att_set = AttributeSet::getByHandle('bootstrap');
$boolean_att = AttributeType::getByHandle('boolean');
$bootstrap_att_1=CollectionAttributeKey::getByHandle('bpli');
SelectAttributeTypeOption::add( $bootstrap_att_4, 'bootstrap');
gwardell replied on at Permalink Reply
gwardell
Did you see my follow up question?