PHP Class Sulu\Bundle\ContactBundle\Contact\ContactManager

Inheritance: extends AbstractContactManager
Mostra file Open project: sulu/sulu Class Usage Examples

Protected Properties

Property Type Description
$mediaRepository Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface

Public Methods

Method Description
__construct ( Doctrine\Common\Persistence\ObjectManager $em, Sulu\Bundle\TagBundle\Tag\TagManagerInterface $tagManager, Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface $mediaManager, AccountRepository $accountRepository, ContactTitleRepository $contactTitleRepository, ContactRepository $contactRepository, Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface $mediaRepository )
addAddress ( Contact $contact, Address $address, boolean $isMain ) : ContactAddress adds an address to the entity.
delete ( ) : Closure Deletes the contact for the given id.
findByFilters ( $filters, $page, $pageSize, $limit, $locale, $options = [] )
findById ( integer $id ) : mixed | null Find a contact by it's id.
getAddressRelations ( $entity ) : mixed Returns a collection of relations to get addresses.
getById ( $id, $locale ) : mixed
getByIds ( $ids, $locale ) : mixed Returns contact entities by ids.
getContact ( $contact, $locale ) : null | Contact Returns an api entity for an doctrine entity.
getContactEntityName ( ) : string Get contact entity name.
removeAddressRelation ( Contact $contact, ContactAddress $contactAddress ) : mixed | void removes the address relation from a contact and also deletes the address if it has no more relations.
save ( array $data, integer | null $id = null, boolean $patch = false, boolean $flush = true ) : Contact Creates a new contact for the given data.
setMainAccount ( Contact $contact, $data )
setTitleOnContact ( $contact, $titleId )

Protected Methods

Method Description
getApiObject ( Contact $contact, string $locale ) : Contact Takes a contact entity and a locale and returns the api object.

Private Methods

Method Description
getProperty ( array $data, string $key, string $default = null ) : string | null Return property for key or given default value.
setAvatar ( Contact $contact, array $avatar ) Sets a media with a given id as the avatar of a given contact.
setMedias ( Contact $contact, $medias ) Sets the medias of the given contact to the given medias.

Method Details

__construct() public method

public __construct ( Doctrine\Common\Persistence\ObjectManager $em, Sulu\Bundle\TagBundle\Tag\TagManagerInterface $tagManager, Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface $mediaManager, AccountRepository $accountRepository, ContactTitleRepository $contactTitleRepository, ContactRepository $contactRepository, Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface $mediaRepository )
$em Doctrine\Common\Persistence\ObjectManager
$tagManager Sulu\Bundle\TagBundle\Tag\TagManagerInterface
$mediaManager Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface
$accountRepository Sulu\Bundle\ContactBundle\Entity\AccountRepository
$contactTitleRepository ContactTitleRepository
$contactRepository Sulu\Bundle\ContactBundle\Entity\ContactRepository
$mediaRepository Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface

addAddress() public method

adds an address to the entity.
public addAddress ( Contact $contact, Address $address, boolean $isMain ) : ContactAddress
$contact Sulu\Bundle\ContactBundle\Entity\Contact The entity to add the address to
$address Sulu\Bundle\ContactBundle\Entity\Address The address to be added
$isMain boolean Defines if the address is the main Address of the contact
return Sulu\Bundle\ContactBundle\Entity\ContactAddress

delete() public method

Deletes the contact for the given id.
public delete ( ) : Closure
return Closure

findByFilters() public method

public findByFilters ( $filters, $page, $pageSize, $limit, $locale, $options = [] )

findById() public method

Find a contact by it's id.
public findById ( integer $id ) : mixed | null
$id integer
return mixed | null

getAddressRelations() public method

Returns a collection of relations to get addresses.
public getAddressRelations ( $entity ) : mixed
$entity
return mixed

getApiObject() protected method

Takes a contact entity and a locale and returns the api object.
protected getApiObject ( Contact $contact, string $locale ) : Contact
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$locale string
return Sulu\Bundle\ContactBundle\Api\Contact

getById() public method

public getById ( $id, $locale ) : mixed
$id
$locale
return mixed

getByIds() public method

Returns contact entities by ids.
public getByIds ( $ids, $locale ) : mixed
$ids
$locale
return mixed

getContact() public method

Returns an api entity for an doctrine entity.
public getContact ( $contact, $locale ) : null | Contact
$contact
$locale
return null | Sulu\Bundle\ContactBundle\Entity\Contact

getContactEntityName() public method

Get contact entity name.
public getContactEntityName ( ) : string
return string

removeAddressRelation() public method

removes the address relation from a contact and also deletes the address if it has no more relations.
public removeAddressRelation ( Contact $contact, ContactAddress $contactAddress ) : mixed | void
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$contactAddress Sulu\Bundle\ContactBundle\Entity\ContactAddress
return mixed | void

save() public method

Creates a new contact for the given data.
public save ( array $data, integer | null $id = null, boolean $patch = false, boolean $flush = true ) : Contact
$data array
$id integer | null
$patch boolean
$flush boolean
return Sulu\Bundle\ContactBundle\Entity\Contact

setMainAccount() public method

public setMainAccount ( Contact $contact, $data )
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$data

setTitleOnContact() public method

public setTitleOnContact ( $contact, $titleId )
$contact
$titleId

Property Details

$mediaRepository protected_oe property

protected MediaRepositoryInterface,Sulu\Bundle\MediaBundle\Entity $mediaRepository
return Sulu\Bundle\MediaBundle\Entity\MediaRepositoryInterface