public function generateAlias (DataContainer $dc)
	{
		$db = Database::getInstance();

		// Generate alias from theme name and title
		$alias = \StringUtil::generateAlias(\ThemeModel::findById($dc->activeRecord->pid)->name . '-' . $dc->activeRecord->title);
		
		if ($alias != $dc->activeRecord->alias)
		{
			// Save alias to database
			$db->prepare("UPDATE tl_elements SET alias=? WHERE id=?")
			   ->execute($alias, $dc->activeRecord->id);
		
			if ($dc->activeRecord->alias)
			{
				// Also change the type (=alias) in tl_content table
				$db->prepare("UPDATE tl_content SET type=? WHERE type=?")
				   ->execute($alias, $dc->activeRecord->alias);
			}
		}
	}
public function generateAlias (DataContainer $dc)
	{
		$db = Database::getInstance();

		// Generate alias from theme name and title
		$alias = \StringUtil::generateAlias(\ThemeModel::findById($dc->activeRecord->pid)->name . '-' . $dc->activeRecord->title);
		
		if ($alias != $dc->activeRecord->alias)
		{
			// Save alias to database
			$db->prepare("UPDATE tl_elements SET alias=? WHERE id=?")
			   ->execute($alias, $dc->activeRecord->id);
		
			if ($dc->activeRecord->alias)
			{
				// Also change the type (=alias) in tl_content table
				$db->prepare("UPDATE tl_content SET type=? WHERE type=?")
				   ->execute($alias, $dc->activeRecord->alias);
			}
		}
	}
public function generateAlias ( DataContainer $ dc ) { $ db = Database :: getInstance ( ) ; // Generate alias from theme name and title $ alias = \ StringUtil :: generateAlias ( \ ThemeModel :: findById ( $ dc -> activeRecord -> pid ) -> name . '-' . $ dc -> activeRecord -> title ) ; if ( $ alias != $ dc -> activeRecord -> alias ) { // Save alias to database $ db -> prepare ( "UPDATE tl_elements SET alias=? WHERE id=?" ) -> execute ( $ alias , $ dc -> activeRecord -> id ) ; if ( $ dc -> activeRecord -> alias ) { // Also change the type (=alias) in tl_content table $ db -> prepare ( "UPDATE tl_content SET type=? WHERE type=?" ) -> execute ( $ alias , $ dc -> activeRecord -> alias ) ; } } }
Auto-generate an element alias and adjust existing content in case the element is renamed

@param DataContainer $dc
Auto - generate an element alias and adjust existing content in case the element is renamed