PHP Class Sulu\Bundle\ContactBundle\Controller\AccountController

Inheritance: extends Sulu\Component\Rest\RestController, implements FOS\RestBundle\Routing\ClassResourceInterface, implements Sulu\Component\Security\SecuredControllerInterface
Show file Open project: sulu/sulu

Protected Properties

Property Type Description
$accountAddressEntityName
$accountAddressesFieldDescriptors
$accountContactEntityName
$accountContactFieldDescriptors
$accountManager Sulu\Bundle\ContactBundle\Contact\AccountManager
$accountSerializationGroups
$addressEntityName
$bundlePrefix
$contactEntityKey
$countryEntityName
$entityKey
$fieldDescriptors Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor[]
$locale
$positionEntityName

Public Methods

Method Description
cgetAction ( Request $request ) : Response Lists all accounts.
deleteAction ( $id, Request $request ) : Response Delete an account with the given id.
deleteContactsAction ( integer $accountId, integer $contactId ) : Response Deleted account contact.
fieldsAction ( ) : mixed Returns all fields that can be used by list.
getAction ( integer $id, Request $request ) : Response Shows a single account with the given id.
getAddressesAction ( integer $id, Request $request ) : Response Lists all addresses of an account optional parameter 'flat' calls listAction.
getContactsAction ( integer $id, Request $request ) : Response Lists all contacts of an account.
getDeleteinfoAction ( $id ) : Response Returns information about data which will be also deleted: 3 contacts, total number of contacts, and if deleting is allowed (as 0 or 1).
getSecurityContext ( )
multipledeleteinfoAction ( Request $request ) : Response Returns delete info for multiple ids.
patchAction ( $id, Request $request ) : Response Partial update of account infos.
postAction ( Request $request ) : Response Creates a new account.
putAction ( integer $id, Request $request ) : Response Edits the existing contact with the given id.
putContactsAction ( integer $accountId, $contactId, Request $request ) : Response

Protected Methods

Method Description
applyRequestParameters ( Request $request, array $filter, DoctrineListBuilder $listBuilder ) Applies the filter parameter and hasNoparent parameter for listbuilder.
doPatch ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, Request $request, Doctrine\Common\Persistence\ObjectManager $entityManager ) Process geiven entity for patch.
doPost ( Request $request ) : Sulu\Bundle\ContactBundle\Entity\AccountInterface Maps data from request to a new account.
doPut ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, Request $request ) processes given entity for put.
generateFlatListBuilder ( ) : DoctrineListBuilder Creates a listbuilder instance.
getAccountAddressesFieldDescriptors ( ) : null | array
getAccountContactFieldDescriptors ( ) : null | array
getAccountEntityName ( ) : string
getAccountManager ( ) : AbstractContactManager
getFieldDescriptorForNoParent ( ) : DoctrineFieldDescriptor Returns fielddescriptor used for checking if account has no parent Will result in an error when added to the array of fielddescriptors because its just for checking if parent exists or not and does not point to a property of the parent.
getFieldDescriptors ( )
getRestHelper ( ) : Sulu\Component\Rest\RestHelperInterface
initAccountAddressesFieldDescriptors ( ) Inits the account contact descriptors.
initAccountContactFieldDescriptors ( ) Inits the account contact descriptors.
initFieldDescriptors ( ) Initializes the field descriptors.

Private Methods

Method Description
addLogos ( array $accounts, string $locale ) : array Takes an array of accounts and resets the logo-property containing the media id with the actual urls to the logo thumbnails.
retrieveFilter ( Request $request, &$count ) : array Retrieves the ids from the request.
setParent ( array $parentData, Sulu\Bundle\ContactBundle\Entity\AccountInterface $account ) Set parent to account.

Method Details

applyRequestParameters() protected method

Applies the filter parameter and hasNoparent parameter for listbuilder.
protected applyRequestParameters ( Request $request, array $filter, DoctrineListBuilder $listBuilder )
$request Symfony\Component\HttpFoundation\Request
$filter array
$listBuilder Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilder

cgetAction() public method

Optional parameter 'flat' calls listAction.
public cgetAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

deleteAction() public method

Delete an account with the given id.
public deleteAction ( $id, Request $request ) : Response
$id
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

deleteContactsAction() public method

Deleted account contact.
public deleteContactsAction ( integer $accountId, integer $contactId ) : Response
$accountId integer
$contactId integer
return Symfony\Component\HttpFoundation\Response

doPatch() protected method

Process geiven entity for patch.
protected doPatch ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, Request $request, Doctrine\Common\Persistence\ObjectManager $entityManager )
$account Sulu\Bundle\ContactBundle\Entity\AccountInterface
$request Symfony\Component\HttpFoundation\Request
$entityManager Doctrine\Common\Persistence\ObjectManager

doPost() protected method

Maps data from request to a new account.
protected doPost ( Request $request ) : Sulu\Bundle\ContactBundle\Entity\AccountInterface
$request Symfony\Component\HttpFoundation\Request
return Sulu\Bundle\ContactBundle\Entity\AccountInterface

doPut() protected method

processes given entity for put.
protected doPut ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, Request $request )
$account Sulu\Bundle\ContactBundle\Entity\AccountInterface
$request Symfony\Component\HttpFoundation\Request

fieldsAction() public method

Returns all fields that can be used by list.
public fieldsAction ( ) : mixed
return mixed

generateFlatListBuilder() protected method

Creates a listbuilder instance.
protected generateFlatListBuilder ( ) : DoctrineListBuilder
return Sulu\Component\Rest\ListBuilder\Doctrine\DoctrineListBuilder

getAccountAddressesFieldDescriptors() protected method

getAccountContactFieldDescriptors() protected method

getAccountEntityName() protected method

protected getAccountEntityName ( ) : string
return string

getAccountManager() protected method

protected getAccountManager ( ) : AbstractContactManager
return AbstractContactManager

getAction() public method

Shows a single account with the given id.
public getAction ( integer $id, Request $request ) : Response
$id integer
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

getAddressesAction() public method

Lists all addresses of an account optional parameter 'flat' calls listAction.
public getAddressesAction ( integer $id, Request $request ) : Response
$id integer
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

getContactsAction() public method

optional parameter 'flat' calls listAction.
public getContactsAction ( integer $id, Request $request ) : Response
$id integer
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

getDeleteinfoAction() public method

Returns information about data which will be also deleted: 3 contacts, total number of contacts, and if deleting is allowed (as 0 or 1).
public getDeleteinfoAction ( $id ) : Response
$id
return Symfony\Component\HttpFoundation\Response

getFieldDescriptorForNoParent() protected method

Returns fielddescriptor used for checking if account has no parent Will result in an error when added to the array of fielddescriptors because its just for checking if parent exists or not and does not point to a property of the parent.
protected getFieldDescriptorForNoParent ( ) : DoctrineFieldDescriptor
return Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor

getFieldDescriptors() protected method

protected getFieldDescriptors ( )

getRestHelper() protected method

protected getRestHelper ( ) : Sulu\Component\Rest\RestHelperInterface
return Sulu\Component\Rest\RestHelperInterface

getSecurityContext() public method

public getSecurityContext ( )

initAccountAddressesFieldDescriptors() protected method

Inits the account contact descriptors.

initAccountContactFieldDescriptors() protected method

Inits the account contact descriptors.

initFieldDescriptors() protected method

Initializes the field descriptors.
protected initFieldDescriptors ( )

multipledeleteinfoAction() public method

Returns delete info for multiple ids.
public multipledeleteinfoAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

patchAction() public method

Partial update of account infos.
public patchAction ( $id, Request $request ) : Response
$id
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

postAction() public method

Creates a new account.
public postAction ( Request $request ) : Response
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

putAction() public method

Edits the existing contact with the given id.
public putAction ( integer $id, Request $request ) : Response
$id integer The id of the contact to update
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

putContactsAction() public method

public putContactsAction ( integer $accountId, $contactId, Request $request ) : Response
$accountId integer
$request Symfony\Component\HttpFoundation\Request
return Symfony\Component\HttpFoundation\Response

Property Details

$accountAddressEntityName protected static property

protected static $accountAddressEntityName

$accountAddressesFieldDescriptors protected property

protected $accountAddressesFieldDescriptors

$accountContactEntityName protected static property

protected static $accountContactEntityName

$accountContactFieldDescriptors protected property

protected $accountContactFieldDescriptors

$accountManager protected property

protected AccountManager,Sulu\Bundle\ContactBundle\Contact $accountManager
return Sulu\Bundle\ContactBundle\Contact\AccountManager

$accountSerializationGroups protected static property

protected static $accountSerializationGroups

$addressEntityName protected static property

protected static $addressEntityName

$bundlePrefix protected property

protected $bundlePrefix

$contactEntityKey protected static property

protected static $contactEntityKey

$countryEntityName protected static property

protected static $countryEntityName

$entityKey protected static property

protected static $entityKey

$fieldDescriptors protected property

protected DoctrineFieldDescriptor[],Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor $fieldDescriptors
return Sulu\Component\Rest\ListBuilder\Doctrine\FieldDescriptor\DoctrineFieldDescriptor[]

$locale protected property

protected $locale

$positionEntityName protected static property

protected static $positionEntityName