eZ Community » Forums » eZ Publish 5 Platform » using new api to create a content type

using new api to create a content type

using new api to create a content type

Wednesday 27 August 2014 9:25:39 am - 2 replies

Hi. I'm playing with the new api in order to add more content classes to a existing install.

I have built a cli command to do that. More or less command looks like this

It seems class and attributes are added to the database, but class seems to be saved with draft state.

So, the question, do i need to use any kind of update command to change the status of the class from draft to defined?

Thanks in advance

Modified on Wednesday 27 August 2014 9:53:50 am by Carlos Revillo

Wednesday 27 August 2014 10:01:25 am

Hi Carlos

As the phpDoc states, ContentTypeService::createContentType() will create the content type object in draft state, so this is perfectly expected. You need to call ContentTypeService::publishContentType() in the end.

You may have a look at the corresponding recipe in the Public API cookbook blunk.gif Emoticon.

Wednesday 27 August 2014 10:09:32 am

Wops. I missed that page in the cookbok. All is clear now. Really easier than legacy code by the way.

p.s. method seems to be publishContentTypeDraft instead of publishContentType.

Thanks a lot!


You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from