PHP Class Sulu\Bundle\ContactBundle\Contact\AbstractContactManager

Inheritance: implements Sulu\Bundle\ContactBundle\Contact\ContactManagerInterface, use trait Sulu\Component\Persistence\RelationTrait
Afficher le fichier Open project: sulu/sulu Class Usage Examples

Protected Properties

Свойство Type Description
$accountContactEntityName
$addressEntityName
$addressTypeEntityName
$categoryEntityName
$countryEntityName
$em Doctrine\Common\Persistence\ObjectManager
$emailEntityName
$emailTypeEntityName
$faxTypeEntityName
$mediaManager Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface
$phoneEntityName
$phoneTypeEntityName
$positionEntityName
$tagManager Sulu\Bundle\TagBundle\Tag\TagManagerInterface
$urlEntityName
$urlTypeEntityName

Méthodes publiques

Méthode Description
__construct ( Doctrine\Common\Persistence\ObjectManager $em, Sulu\Bundle\TagBundle\Tag\TagManagerInterface $tagManager, Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface $mediaManager )
addNewContactRelations ( Contact $contact, array $data ) adds new relations.
contactIsEmployeeOfAccount ( $contact, $account ) : boolean checks if an account is employee of a company.
createMainAccountContact ( Contact $contact, Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, $position = null ) : AccountContact creates a new main Account Contacts relation.
deleteAddresses ( $entity ) deletes all addresses that are assigned to entity.
deleteAllRelations ( $entity ) clears all relational data from entity and deletes it.
deleteEmails ( $entity ) deletes all emails that are assigned to entity.
deleteFaxes ( $entity ) deletes all faxes that are assigned to entity.
deleteNotes ( $entity ) deletes all notes that are assigned to entity.
deletePhones ( $entity ) deletes all phones that are assigned to entity.
deleteUrls ( $entity ) deletes all urls that are assigned to entity.
getAccounContact ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, Contact $contact ) : null | AccountContact Returns AccountContact relation if exists.
getAddressByCondition ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity, callable $conditionCallback, boolean $force = false ) : mixed Returns an address by callback-condition.
getAddressTypeByName ( $name ) : mixed return address type by name.
getBillingAddress ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity, boolean $force = false ) : mixed Returns the billing address of an account/contact.
getDeliveryAddress ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity, boolean $force = false ) : mixed Returns the delivery address.
getEmailTypeByName ( $name ) : mixed return email type by name.
getFaxTypeByName ( $name ) : mixed return fax type by name.
getMainAccountContact ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $contact ) : AccountContact | boolean returns the main account-contact relation.
getPhoneTypeByName ( $name ) : mixed return phone type by name.
getPosition ( $data ) : mixed Get a position object.
getTagManager ( ) : Sulu\Bundle\TagBundle\Tag\TagManagerInterface Returns the tag manager.
getUrlTypeByName ( $name ) : mixed return url type by name.
processAddresses ( $contact, array $addresses ) : boolean Process all addresses from request.
processBankAccounts ( $contact, $bankAccounts ) : boolean Process all bankAccounts of a request.
processCategories ( $contact, $categories ) : boolean Process all categories of request.
processEmails ( $contact, $emails ) : boolean Process all emails from request.
processFaxes ( $contact, array $faxes ) : boolean
processNotes ( Contact $contact, $notes ) : boolean Process all notes from request.
processPhones ( $contact, $phones ) : boolean Process all phones from request.
processTags ( $contact, array $tags ) : boolean Process all tags of request.
processUrls ( $contact, array $urls ) : boolean Process all urls of request.
setMainEmail ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity ) sets Entity's Main-Email.
setMainFax ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity ) sets Entity's Main-Fax.
setMainForCollection ( $arrayCollection ) sets the first element to main, if none is set.
setMainPhone ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity ) sets Entity's Main-Phone.
setMainUrl ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity ) sets Entity's Main-Url.
unsetMain ( $arrayCollection ) : boolean unsets main of all elements of an ArrayCollection | PersistanceCollection.

Méthodes protégées

Méthode Description
addBankAccount ( $contact, $data ) : boolean Add a new note to the given contact and persist it with the given object manager.
addCategories ( $contact, $data ) : boolean Adds a new category to the given contact.
addEmail ( Contact $contact, array $emailData ) : boolean Adds a new email to the given contact and persist it with the given object manager.
addFax ( $contact, array $faxData )
addNote ( $contact, array $noteData ) : boolean Add a new note to the given contact and persist it with the given object manager.
addPhone ( $contact, array $phoneData ) : boolean Add a new phone to the given contact and persist it with the given object manager.
addTag ( $contact, $data ) : boolean Adds a new tag to the given contact and persist it with the given object manager.
addUrl ( $contact, $data ) : boolean Adds a new tag to the given contact.
checkAndSetMainAddress ( $addresses ) : mixed sets main address.
createAddress ( array $addressData, &$isMain = null ) : Address Creates an address based on the data passed.
deleteAllEntitiesOfCollection ( $arrayCollection )
getBooleanValue ( $value ) : boolean Checks if a value is a boolean and converts it if necessary and returns it.
updateAddress ( Address $address, mixed $entry, boolean &$isMain = null ) : boolean Updates the given address.
updateBankAccount ( BankAccount $entity, string $data ) : boolean Updates the given note.
updateEmail ( Email $email, array $entry ) : boolean Updates the given email address.
updateFax ( Fax $fax, $entry ) : boolean
updateNote ( Note $note, array $entry ) : boolean Updates the given note.
updatePhone ( Phone $phone, $entry ) : boolean Updates the given phone.
updateUrl ( Url $url, $entry ) : boolean

Private Methods

Méthode Description
getAddresses ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity ) : Doctrine\Common\Collections\Collection | null returns addresses from account or contact.
getProperty ( array $data, string $key, string $default = null ) : string | null Return property for key or given default value.
hasMain ( $arrayCollection, &$mainEntity = null ) : mixed checks if a collection for main attribute.
resetIndexOfSubentites ( mixed $entities ) TODO: this is just a hack to avoid relations that start with index != 0 otherwise deserialization process will parse relations as object instead of an array reindex entities.

Method Details

__construct() public méthode

public __construct ( Doctrine\Common\Persistence\ObjectManager $em, Sulu\Bundle\TagBundle\Tag\TagManagerInterface $tagManager, Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface $mediaManager )
$em Doctrine\Common\Persistence\ObjectManager
$tagManager Sulu\Bundle\TagBundle\Tag\TagManagerInterface
$mediaManager Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface

addBankAccount() protected méthode

Add a new note to the given contact and persist it with the given object manager.
protected addBankAccount ( $contact, $data ) : boolean
$contact
$data
Résultat boolean

addCategories() protected méthode

Adds a new category to the given contact.
protected addCategories ( $contact, $data ) : boolean
$contact
$data
Résultat boolean

addEmail() protected méthode

Adds a new email to the given contact and persist it with the given object manager.
protected addEmail ( Contact $contact, array $emailData ) : boolean
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$emailData array
Résultat boolean

addFax() protected méthode

protected addFax ( $contact, array $faxData )
$contact
$faxData array

addNewContactRelations() public méthode

adds new relations.
public addNewContactRelations ( Contact $contact, array $data )
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$data array

addNote() protected méthode

Add a new note to the given contact and persist it with the given object manager.
protected addNote ( $contact, array $noteData ) : boolean
$contact
$noteData array
Résultat boolean True if there was no error, otherwise false

addPhone() protected méthode

Add a new phone to the given contact and persist it with the given object manager.
protected addPhone ( $contact, array $phoneData ) : boolean
$contact
$phoneData array
Résultat boolean True if there was no error, otherwise false

addTag() protected méthode

Adds a new tag to the given contact and persist it with the given object manager.
protected addTag ( $contact, $data ) : boolean
$contact
$data
Résultat boolean True if there was no error, otherwise false

addUrl() protected méthode

Adds a new tag to the given contact.
protected addUrl ( $contact, $data ) : boolean
$contact
$data
Résultat boolean

checkAndSetMainAddress() protected méthode

sets main address.
protected checkAndSetMainAddress ( $addresses ) : mixed
$addresses
Résultat mixed

contactIsEmployeeOfAccount() public méthode

checks if an account is employee of a company.
public contactIsEmployeeOfAccount ( $contact, $account ) : boolean
$contact
$account
Résultat boolean

createAddress() protected méthode

Creates an address based on the data passed.
protected createAddress ( array $addressData, &$isMain = null ) : Address
$addressData array
$isMain returns if address is main address
Résultat Sulu\Bundle\ContactBundle\Entity\Address

createMainAccountContact() public méthode

creates a new main Account Contacts relation.
public createMainAccountContact ( Contact $contact, Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, $position = null ) : AccountContact
$contact Sulu\Bundle\ContactBundle\Entity\Contact
$account Sulu\Bundle\ContactBundle\Entity\AccountInterface
$position
Résultat Sulu\Bundle\ContactBundle\Entity\AccountContact

deleteAddresses() public méthode

deletes all addresses that are assigned to entity.
public deleteAddresses ( $entity )
$entity

deleteAllEntitiesOfCollection() protected méthode

protected deleteAllEntitiesOfCollection ( $arrayCollection )
$arrayCollection

deleteAllRelations() public méthode

clears all relational data from entity and deletes it.
public deleteAllRelations ( $entity )
$entity

deleteEmails() public méthode

deletes all emails that are assigned to entity.
public deleteEmails ( $entity )
$entity

deleteFaxes() public méthode

deletes all faxes that are assigned to entity.
public deleteFaxes ( $entity )
$entity

deleteNotes() public méthode

deletes all notes that are assigned to entity.
public deleteNotes ( $entity )
$entity

deletePhones() public méthode

deletes all phones that are assigned to entity.
public deletePhones ( $entity )
$entity

deleteUrls() public méthode

deletes all urls that are assigned to entity.
public deleteUrls ( $entity )
$entity

getAccounContact() public méthode

Returns AccountContact relation if exists.
public getAccounContact ( Sulu\Bundle\ContactBundle\Entity\AccountInterface $account, Contact $contact ) : null | AccountContact
$account Sulu\Bundle\ContactBundle\Entity\AccountInterface
$contact Sulu\Bundle\ContactBundle\Entity\Contact
Résultat null | Sulu\Bundle\ContactBundle\Entity\AccountContact

getAddressByCondition() public méthode

Returns an address by callback-condition.
public getAddressByCondition ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity, callable $conditionCallback, boolean $force = false ) : mixed
$entity Sulu\Bundle\ContactBundle\Entity\AccountInterface | Sulu\Bundle\ContactBundle\Entity\Contact
$conditionCallback callable
$force boolean Forces function to return an address if any address is defined if no delivery address is defined it will first return the main address then any
Résultat mixed

getAddressTypeByName() public méthode

return address type by name.
public getAddressTypeByName ( $name ) : mixed
$name
Résultat mixed

getBillingAddress() public méthode

Returns the billing address of an account/contact.
public getBillingAddress ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity, boolean $force = false ) : mixed
$entity Sulu\Bundle\ContactBundle\Entity\AccountInterface | Sulu\Bundle\ContactBundle\Entity\Contact
$force boolean Forces function to return an address if any address is defined if no delivery address is defined it will first return the main address then any
Résultat mixed

getBooleanValue() protected méthode

Checks if a value is a boolean and converts it if necessary and returns it.
protected getBooleanValue ( $value ) : boolean
$value
Résultat boolean

getDeliveryAddress() public méthode

Returns the delivery address.
public getDeliveryAddress ( Sulu\Bundle\ContactBundle\Entity\AccountInterface | Contact $entity, boolean $force = false ) : mixed
$entity Sulu\Bundle\ContactBundle\Entity\AccountInterface | Sulu\Bundle\ContactBundle\Entity\Contact
$force boolean Forces function to return an address if any address is defined if no delivery address is defined it will first return the main address then any
Résultat mixed

getEmailTypeByName() public méthode

return email type by name.
public getEmailTypeByName ( $name ) : mixed
$name
Résultat mixed

getFaxTypeByName() public méthode

return fax type by name.
public getFaxTypeByName ( $name ) : mixed
$name
Résultat mixed

getMainAccountContact() public méthode

returns the main account-contact relation.
public getMainAccountContact ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $contact ) : AccountContact | boolean
$contact Sulu\Bundle\ContactBundle\Entity\Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface
Résultat Sulu\Bundle\ContactBundle\Entity\AccountContact | boolean

getPhoneTypeByName() public méthode

return phone type by name.
public getPhoneTypeByName ( $name ) : mixed
$name
Résultat mixed

getPosition() public méthode

Get a position object.
public getPosition ( $data ) : mixed
Résultat mixed

getTagManager() public méthode

Returns the tag manager.
public getTagManager ( ) : Sulu\Bundle\TagBundle\Tag\TagManagerInterface
Résultat Sulu\Bundle\TagBundle\Tag\TagManagerInterface

getUrlTypeByName() public méthode

return url type by name.
public getUrlTypeByName ( $name ) : mixed
$name
Résultat mixed

processAddresses() public méthode

Process all addresses from request.
public processAddresses ( $contact, array $addresses ) : boolean
$contact The contact on which is worked
$addresses array
Résultat boolean True if the processing was sucessful, otherwise false

processBankAccounts() public méthode

Process all bankAccounts of a request.
public processBankAccounts ( $contact, $bankAccounts ) : boolean
$contact
$bankAccounts
Résultat boolean True if the processing was sucessful, otherwise false

processCategories() public méthode

Process all categories of request.
public processCategories ( $contact, $categories ) : boolean
$contact - the contact which is processed
$categories
Résultat boolean True if the processing was successful, otherwise false

processEmails() public méthode

Process all emails from request.
public processEmails ( $contact, $emails ) : boolean
$contact The contact on which is worked
$emails
Résultat boolean True if the processing was successful, otherwise false

processFaxes() public méthode

public processFaxes ( $contact, array $faxes ) : boolean
$contact
$faxes array
Résultat boolean

processNotes() public méthode

Process all notes from request.
public processNotes ( Contact $contact, $notes ) : boolean
$contact Sulu\Bundle\ContactBundle\Entity\Contact The contact on which is worked
$notes
Résultat boolean True if the processing was successful, otherwise false

processPhones() public méthode

Process all phones from request.
public processPhones ( $contact, $phones ) : boolean
$contact The contact on which is processed
$phones
Résultat boolean True if the processing was successful, otherwise false

processTags() public méthode

Process all tags of request.
public processTags ( $contact, array $tags ) : boolean
$contact The contact on which is worked
$tags array
Résultat boolean True if the processing was successful, otherwise false

processUrls() public méthode

Process all urls of request.
public processUrls ( $contact, array $urls ) : boolean
$contact The contact to be processed
$urls array
Résultat boolean True if the processing was successful, otherwise false

setMainEmail() public méthode

sets Entity's Main-Email.
public setMainEmail ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity )
$entity Sulu\Bundle\ContactBundle\Entity\Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface

setMainFax() public méthode

sets Entity's Main-Fax.
public setMainFax ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity )
$entity Sulu\Bundle\ContactBundle\Entity\Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface

setMainForCollection() public méthode

sets the first element to main, if none is set.
public setMainForCollection ( $arrayCollection )
$arrayCollection

setMainPhone() public méthode

sets Entity's Main-Phone.
public setMainPhone ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity )
$entity Sulu\Bundle\ContactBundle\Entity\Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface

setMainUrl() public méthode

sets Entity's Main-Url.
public setMainUrl ( Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface $entity )
$entity Sulu\Bundle\ContactBundle\Entity\Contact | Sulu\Bundle\ContactBundle\Entity\AccountInterface

unsetMain() public méthode

unsets main of all elements of an ArrayCollection | PersistanceCollection.
public unsetMain ( $arrayCollection ) : boolean
$arrayCollection
Résultat boolean returns true if a element was unset

updateAddress() protected méthode

Updates the given address.
protected updateAddress ( Address $address, mixed $entry, boolean &$isMain = null ) : boolean
$address Sulu\Bundle\ContactBundle\Entity\Address The phone object to update
$entry mixed The entry with the new data
$isMain boolean returns if address should be set to main
Résultat boolean True if successful, otherwise false

updateBankAccount() protected méthode

Updates the given note.
protected updateBankAccount ( BankAccount $entity, string $data ) : boolean
$entity Sulu\Bundle\ContactBundle\Entity\BankAccount The phone object to update
$data string The entry with the new data
Résultat boolean True if successful, otherwise false

updateEmail() protected méthode

Updates the given email address.
protected updateEmail ( Email $email, array $entry ) : boolean
$email Sulu\Bundle\ContactBundle\Entity\Email The email object to update
$entry array The entry with the new data
Résultat boolean True if successful, otherwise false

updateFax() protected méthode

protected updateFax ( Fax $fax, $entry ) : boolean
$fax Sulu\Bundle\ContactBundle\Entity\Fax
$entry
Résultat boolean

updateNote() protected méthode

Updates the given note.
protected updateNote ( Note $note, array $entry ) : boolean
$note Sulu\Bundle\ContactBundle\Entity\Note
$entry array The entry with the new data
Résultat boolean True if successful, otherwise false

updatePhone() protected méthode

Updates the given phone.
protected updatePhone ( Phone $phone, $entry ) : boolean
$phone Sulu\Bundle\ContactBundle\Entity\Phone The phone object to update
$entry The entry with the new data
Résultat boolean True if successful, otherwise false

updateUrl() protected méthode

protected updateUrl ( Url $url, $entry ) : boolean
$url Sulu\Bundle\ContactBundle\Entity\Url
$entry
Résultat boolean

Property Details

$accountContactEntityName protected_oe static_oe property

protected static $accountContactEntityName

$addressEntityName protected_oe static_oe property

protected static $addressEntityName

$addressTypeEntityName protected_oe static_oe property

protected static $addressTypeEntityName

$categoryEntityName protected_oe static_oe property

protected static $categoryEntityName

$countryEntityName protected_oe static_oe property

protected static $countryEntityName

$em protected_oe property

protected ObjectManager,Doctrine\Common\Persistence $em
Résultat Doctrine\Common\Persistence\ObjectManager

$emailEntityName protected_oe static_oe property

protected static $emailEntityName

$emailTypeEntityName protected_oe static_oe property

protected static $emailTypeEntityName

$faxTypeEntityName protected_oe static_oe property

protected static $faxTypeEntityName

$mediaManager protected_oe property

protected MediaManagerInterface,Sulu\Bundle\MediaBundle\Media\Manager $mediaManager
Résultat Sulu\Bundle\MediaBundle\Media\Manager\MediaManagerInterface

$phoneEntityName protected_oe static_oe property

protected static $phoneEntityName

$phoneTypeEntityName protected_oe static_oe property

protected static $phoneTypeEntityName

$positionEntityName protected_oe static_oe property

protected static $positionEntityName

$tagManager protected_oe property

protected TagManagerInterface,Sulu\Bundle\TagBundle\Tag $tagManager
Résultat Sulu\Bundle\TagBundle\Tag\TagManagerInterface

$urlEntityName protected_oe static_oe property

protected static $urlEntityName

$urlTypeEntityName protected_oe static_oe property

protected static $urlTypeEntityName