Entity/BlockManager.php
/**
     * Updates position for given block.
     *
     * @param int  $id       Block Id
     * @param int  $position New Position
     * @param int  $parentId Parent block Id (needed when partial = true)
     * @param int  $pageId   Page Id (needed when partial = true)
     * @param bool $partial  Should we use partial references? (Better for performance, but can lead to query issues.)
     *
     * @return mixed
     */
Updates position for given block.

@return mixed
Updates position for given block . @return mixed
public function updatePosition($id, $position, $parentId = null, $pageId = null, $partial = true)
    {
        if ($partial) {
            $meta = $this->getEntityManager()->getClassMetadata($this->getClass());
            $block = $this->getEntityManager()->getReference($this->getClass(), $id);
            $pageRelation = $meta->getAssociationMapping('page');
            $page = $this->getEntityManager()->getPartialReference($pageRelation['targetEntity'], $pageId);
            $parentRelation = $meta->getAssociationMapping('parent');
            $parent = $this->getEntityManager()->getPartialReference($parentRelation['targetEntity'], $parentId);
            $block->setPage($page);
            $block->setParent($parent);
        } else {
            $block = $this->find($id);
        }
        $block->setPosition($position);
        $this->getEntityManager()->persist($block);
        return $block;
    }
public function updatePosition ( $ id , $ position , $ parentId = null , $ pageId = null , $ partial = true ) { if ( $ partial ) { $ meta = $ this -> getEntityManager ( ) -> getClassMetadata ( $ this -> getClass ( ) ) ; $ block = $ this -> getEntityManager ( ) -> getReference ( $ this -> getClass ( ) , $ id ) ; $ pageRelation = $ meta -> getAssociationMapping ( 'page' ) ; $ page = $ this -> getEntityManager ( ) -> getPartialReference ( $ pageRelation [ 'targetEntity' ] , $ pageId ) ; $ parentRelation = $ meta -> getAssociationMapping ( 'parent' ) ; $ parent = $ this -> getEntityManager ( ) -> getPartialReference ( $ parentRelation [ 'targetEntity' ] , $ parentId ) ; $ block -> setPage ( $ page ) ; $ block -> setParent ( $ parent ) ; } else { $ block = $ this -> find ( $ id ) ; } $ block -> setPosition ( $ position ) ; $ this -> getEntityManager ( ) -> persist ( $ block ) ; return $ block ; }
Updates position for given block.
Updates position for given block .
// retrieve object references // set new values