Forums / General / How to change object names if object name pattern was cha...

How to change object names if object name pattern was cha...

Author Message

Andrey Astakhov

Thursday 28 December 2006 7:52:45 am

It was a necessity to change object name pattern for a class. Howewer it didn't change names of my objects.
I can change object names only after resaving them: just open and send for publish.
But it is not possible to manually resave about 1 thousand objects.

I tried updateniceurls.php script - it didn't help.
I've emptied ezurlalias table and run updateniceurls.php again. It works.

I had no custom url translation but obviously i'd loose all url translations after such procedure.
How to do in a right way? How to update object names according to changed object name pattern.

Kristof Coomans

Thursday 28 December 2006 8:31:57 am

Hi Andre

You need to use the CLI script update/common/scripts/updatecontentobjectname.php

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Andrey Astakhov

Saturday 30 December 2006 6:21:04 am

Thank you very much, Kristof.
It is so simple and so great.

BTW, it is not possible to download your datatypes extension from Contributions section. I've download it from pubsn. Is it still in alpha?

Kristof Coomans

Saturday 30 December 2006 6:28:40 am

Yes, it is. I recently made some big changes which I still need to commit back to the repository.

independent eZ Publish developer and service provider | http://blog.coomanskristof.be | http://ezpedia.org

Jens Tiedemann

Tuesday 11 December 2007 8:49:39 am

Hi - I've added a new attribute 'relation' to the user class, and updated the "object name pattern" to <first_name> <last_name>: <relation>. The relation attribute (customer, partner etc.) is determined at registration time based on the domain name in 'mailid'. By using the following code:

// store in attribute
$relation = $dataMap['relation'];
$relation->setAttribute( 'data_text', $usergroupName );
$relation->sync();

i get the 'relation' attribute updated allright. But like the original post, the full name does not show through, unless the user is "re-published". Adding the code:

// update object to update object content name
$class =& $object->contentClass();
$object->setName( $class->contentObjectName( $object ) );
$object->store();
unset( $class );

did not help. Any other way of updating the user name without running the CLI??

Jens Tiedemann

Tuesday 11 December 2007 10:10:36 am

also tried:

$newVersion =& $object->createNewVersion();
$newData =& $object->fetchDataMap( $newVersion->attribute( 'version' ) );
$relation = $newData['relation'];
$relation->setAttribute( 'data_text', $usergroupDisplayName );
$relation->sync();
include_once( 'lib/ezutils/classes/ezoperationhandler.php' );
$result = eZOperationHandler::execute( 'users', 'publish', array( 'object_id' => $object->attribute( 'id' ), 'version' => $newVersion->attribute( 'version' ) ) );

to force publication of a new version with the 'relation' attribute set right - this results in a new draft - but the draft is not actually published.... anybody knows how to force the publication of a user object?

eZ debug

Timing: Jan 18 2025 11:13:33
Script start
Timing: Jan 18 2025 11:13:33
Module start 'content'
Timing: Jan 18 2025 11:13:34
Module end 'content'
Timing: Jan 18 2025 11:13:34
Script end

Main resources:

Total runtime0.6843 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0076 589.0938180.8047
Module start 'content' 0.00760.5531 769.8984612.9219
Module end 'content' 0.56080.1235 1,382.8203337.0313
Script end 0.6843  1,719.8516 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00440.6464210.0002
Check MTime0.00150.2200210.0001
Mysql Total
Database connection0.00070.099210.0007
Mysqli_queries0.604288.28652050.0029
Looping result0.00200.29312030.0000
Template Total0.656195.920.3281
Template load0.00200.296520.0010
Template processing0.654195.580120.3270
Template load and register function0.00020.031610.0002
states
state_id_array0.00090.129910.0009
state_identifier_array0.00080.120020.0004
Override
Cache load0.00180.2559440.0000
Sytem overhead
Fetch class attribute can translate value0.00140.199440.0003
Fetch class attribute name0.00100.151270.0001
XML
Image XML parsing0.00110.165140.0003
class_abstraction
Instantiating content class attribute0.00000.002280.0000
General
dbfile0.00500.7333270.0002
String conversion0.00000.001130.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
7content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
11content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 28
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs