I created an event schedule feature based on Pages which I’ve added to the admin panel under the content menu. I created the necessary table, model and handlers, views, etc. I’m getting the following error:
/************************************** PUBLIC *********************************************/
/**
Get the layout or if empty the default convention of “pages”
*/
function getLayoutWithDefault(){
if( len(getLayout()) ){ return getLayout(); }
return “pages”;
}
/**
Get layout with layout inheritance, if none found return normal saved layout
*/
function getLayoutWithInheritance(){
var thisLayout = getLayout();
// check for inheritance and parent?
if( thisLayout eq LAYOUT_INHERITANCE_KEY AND hasParent() ){
return getParent().getLayoutWithInheritance();
}
// Else return the layout
return thisLayout;
}
/**
Get mobile layout with layout inheritance, if none found return normal saved layout
*/
function getMobileLayoutWithInheritance(){
var thisLayout = ( isNull( mobileLayout ) ? ‘’ : mobileLayout );
// check for inheritance and parent?
if( thisLayout eq LAYOUT_INHERITANCE_KEY AND hasParent() ){
return getParent().getMobileLayoutWithInheritance();
}
// Is the mobile layout none, then return the normal layout
return ( !len( thisLayout ) ? getLayoutWithInheritance() : thisLayout );
}
/**
Wipe primary key, and descendant keys, and prepare for cloning of entire hierarchies
@author.hint The author doing the cloning
@original.hint The original content object that will be cloned into this content object
@originalService.hint The ContentBox content service object
@publish.hint Publish pages or leave as drafts
@originalSlugRoot.hint The original slug that will be replaced in all cloned content
@newSlugRoot.hint The new slug root that will be replaced in all cloned content
*/
BaseContent function prepareForClone(required any author,
required any original,
required any originalService,
required boolean publish,
required any originalSlugRoot,
required any newSlugRoot){
setLayout( original.getLayout() );
return super.prepareForClone(argumentCollection=arguments);
}
/*
Validate page, returns an array of error or no messages
*/
array function validate(){
var errors = [];
This is my first time working with ORM so I figured I’d create my own objects based on an existing one. So that why you see so much of the page stuff in there. Most of that will come out eventually once i have a good understanding of how this works. I did as you suggested, scoping out the entire path, but I’m still getting the error. Here is the error
Have you updated Application.cfc, this.ormSettings.dbcreate to be “update”, or did you run a SQL script to create the new table and columns?
If so, did you reload ORM so that the updates would be run/CF would recognize the new entity?
Did a new table called “cb_eventSchedule” get created in your contentbox db?
If the answer is no on any of these (especially the last one), it’s possible you have an error in your entity that CF is just skipping because of the skipCFCWithError setting in Application.cfc.
For example, I notice that there is at least one error in the init() method (missing “=”) sign on eventUniform “”; I don’t know if the actual code from your app, but when I tried to implement your changes to test the issue, that was the first issue I had to get around.
Thanks for responding joel. Here is what I have so far:
Application.cfc has the dbcreate set to update, but I did manually create the table and columns.
Yes, I have reloaded ORM several times but still get the same error.
the table name is cb_eventSchedule.
I also corrected the error you pointed out in the init method reloaded the app, ORM and still get the same error.
That did uncover several other errors in the entity template. I’m worked through those and am at least at the point where it is recognizing the entity and loading its editor in the admin. Stay tuned :). Thanks!