public function delete($dc)
	{
		$model = \ContentModel::findByPk($dc->id);
		$this->objModel = new ContentWrapper\Model($model);

		// getType will throw an exception if type is not found. use it to detect non content wrapper elements
		try {
			$type = $this->objModel->getType();
		}
		catch(\Exception $e)
		{
			return;
		}

		if($this->objModel->getType() == ContentWrapper\Model::TYPE_START)
		{
			$deleteTypes = array();

			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_SEPARATOR, static::TRIGGER_DELETE)) {
				$deleteTypes[] = $this->objModel->getTypeName(ContentWrapper\Model::TYPE_SEPARATOR);
			}

			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_STOP, static::TRIGGER_DELETE)) {
				$deleteTypes[] = $this->objModel->getTypeName(ContentWrapper\Model::TYPE_STOP);
			}

			if(!empty($deleteTypes)) {
				$this->Database
					->prepare(sprintf(
						'DELETE FROM tl_content WHERE bootstrap_parentId=? AND type IN(\'%s\')',
						implode('\',\'', $deleteTypes)
					))
					->execute($this->objModel->id);
			}
		}
		elseif($this->objModel->getType() == ContentWrapper\Model::TYPE_STOP) {
			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_SEPARATOR, static::TRIGGER_DELETE)) {
				$this->Database
					->prepare('DELETE FROM tl_content WHERE bootstrap_parentId=? AND type=?')
					->execute(
						$this->objModel->bootstrap_parentId,
						$this->objModel->getTypeName(ContentWrapper\Model::TYPE_SEPARATOR)
					);
			}

			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_START, static::TRIGGER_DELETE)) {
				$query = sprintf('DELETE FROM %s WHERE id=?', $this->objModel->getModel()->getTable());

				\Database::getInstance()
					->prepare($query)
					->execute($this->objModel->bootstrap_parentId);
			}
		}
		else {
			// todo: handle seperator delete actions
		}
	}
public function delete($dc)
	{
		$model = \ContentModel::findByPk($dc->id);
		$this->objModel = new ContentWrapper\Model($model);

		// getType will throw an exception if type is not found. use it to detect non content wrapper elements
		try {
			$type = $this->objModel->getType();
		}
		catch(\Exception $e)
		{
			return;
		}

		if($this->objModel->getType() == ContentWrapper\Model::TYPE_START)
		{
			$deleteTypes = array();

			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_SEPARATOR, static::TRIGGER_DELETE)) {
				$deleteTypes[] = $this->objModel->getTypeName(ContentWrapper\Model::TYPE_SEPARATOR);
			}

			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_STOP, static::TRIGGER_DELETE)) {
				$deleteTypes[] = $this->objModel->getTypeName(ContentWrapper\Model::TYPE_STOP);
			}

			if(!empty($deleteTypes)) {
				$this->Database
					->prepare(sprintf(
						'DELETE FROM tl_content WHERE bootstrap_parentId=? AND type IN(\'%s\')',
						implode('\',\'', $deleteTypes)
					))
					->execute($this->objModel->id);
			}
		}
		elseif($this->objModel->getType() == ContentWrapper\Model::TYPE_STOP) {
			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_SEPARATOR, static::TRIGGER_DELETE)) {
				$this->Database
					->prepare('DELETE FROM tl_content WHERE bootstrap_parentId=? AND type=?')
					->execute(
						$this->objModel->bootstrap_parentId,
						$this->objModel->getTypeName(ContentWrapper\Model::TYPE_SEPARATOR)
					);
			}

			if($this->isTrigger($this->objModel->getType(), ContentWrapper\Model::TYPE_START, static::TRIGGER_DELETE)) {
				$query = sprintf('DELETE FROM %s WHERE id=?', $this->objModel->getModel()->getTable());

				\Database::getInstance()
					->prepare($query)
					->execute($this->objModel->bootstrap_parentId);
			}
		}
		else {
			// todo: handle seperator delete actions
		}
	}
public function delete ( $ dc ) { $ model = \ ContentModel :: findByPk ( $ dc -> id ) ; $ this -> objModel = new ContentWrapper \ Model ( $ model ) ; // getType will throw an exception if type is not found. use it to detect non content wrapper elements try { $ type = $ this -> objModel -> getType ( ) ; } catch ( \ Exception $ e ) { return ; } if ( $ this -> objModel -> getType ( ) == ContentWrapper \ Model :: TYPE_START ) { $ deleteTypes = array ( ) ; if ( $ this -> isTrigger ( $ this -> objModel -> getType ( ) , ContentWrapper \ Model :: TYPE_SEPARATOR , static :: TRIGGER_DELETE ) ) { $ deleteTypes [ ] = $ this -> objModel -> getTypeName ( ContentWrapper \ Model :: TYPE_SEPARATOR ) ; } if ( $ this -> isTrigger ( $ this -> objModel -> getType ( ) , ContentWrapper \ Model :: TYPE_STOP , static :: TRIGGER_DELETE ) ) { $ deleteTypes [ ] = $ this -> objModel -> getTypeName ( ContentWrapper \ Model :: TYPE_STOP ) ; } if ( ! empty ( $ deleteTypes ) ) { $ this -> Database -> prepare ( sprintf ( 'DELETE FROM tl_content WHERE bootstrap_parentId=? AND type IN(\'%s\')' , implode ( '\',\'' , $ deleteTypes ) ) ) -> execute ( $ this -> objModel -> id ) ; } } elseif ( $ this -> objModel -> getType ( ) == ContentWrapper \ Model :: TYPE_STOP ) { if ( $ this -> isTrigger ( $ this -> objModel -> getType ( ) , ContentWrapper \ Model :: TYPE_SEPARATOR , static :: TRIGGER_DELETE ) ) { $ this -> Database -> prepare ( 'DELETE FROM tl_content WHERE bootstrap_parentId=? AND type=?' ) -> execute ( $ this -> objModel -> bootstrap_parentId , $ this -> objModel -> getTypeName ( ContentWrapper \ Model :: TYPE_SEPARATOR ) ) ; } if ( $ this -> isTrigger ( $ this -> objModel -> getType ( ) , ContentWrapper \ Model :: TYPE_START , static :: TRIGGER_DELETE ) ) { $ query = sprintf ( 'DELETE FROM %s WHERE id=?' , $ this -> objModel -> getModel ( ) -> getTable ( ) ) ; \ Database :: getInstance ( ) -> prepare ( $ query ) -> execute ( $ this -> objModel -> bootstrap_parentId ) ; } } else { // todo: handle seperator delete actions } }
handle content element deletion, called by ondelete_callback
@param $dc
handle content element deletion called by ondelete_callback