loadTypeData() abstract public method

Loads an array with data about $typeId in $status.
abstract public loadTypeData ( mixed $typeId, integer $status ) : array
$typeId mixed
$status integer
return array Data rows.
    /**
     * @throws \eZ\Publish\API\Repository\Exceptions\BadStateException If type is defined and still has content
     * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException If type is not found
     *
     * @param mixed $contentTypeId
     * @param int $status
     *
     * @return boolean
     */
    public function delete( $contentTypeId, $status )
    {
        if ( !$this->contentTypeGateway->loadTypeData( $contentTypeId, $status ) )
        {
            throw new NotFoundException(
                "ContentType",
                array(
                    "id" => $contentTypeId,
                    "status" => $status
                )
            );
        }

        if ( Type::STATUS_DEFINED === $status && $this->contentTypeGateway->countInstancesOfType( $contentTypeId ) )
        {
            throw new BadStateException(
                "\$contentTypeId",
                "ContentType with given id still has content instances and therefore can't be deleted"
            );
        }

        $this->contentTypeGateway->delete(
            $contentTypeId, $status
        );

        // @todo FIXME: Return true only if deletion happened
        return true;
    }
 /**
  * Loads an array with data about $typeId in $status.
  *
  * @param mixed $typeId
  * @param int $status
  *
  * @return array Data rows.
  */
 public function loadTypeData($typeId, $status)
 {
     try {
         return $this->innerGateway->loadTypeData($typeId, $status);
     } catch (DBALException $e) {
         throw new RuntimeException('Database error', 0, $e);
     } catch (PDOException $e) {
         throw new RuntimeException('Database error', 0, $e);
     }
 }
Beispiel #3
0
 /**
  * Loads a content type by id and status.
  *
  * Note: This method is responsible of having the Field Definitions of the loaded ContentType sorted by placement.
  *
  * @param int $contentTypeId
  * @param int $status
  *
  * @return \eZ\Publish\SPI\Persistence\Content\Type
  */
 public function load($contentTypeId, $status = Type::STATUS_DEFINED)
 {
     return $this->loadFromRows($this->contentTypeGateway->loadTypeData($contentTypeId, $status), $contentTypeId, $status);
 }