text:
<!DOCTYPE html>

    <meta charset="UTF-8" />
    <meta name="robots" content="index, follow, all" />
    <title>Thelia\Model\Base\Profile | Thelia 2 API</title>

            <link rel="stylesheet" type="text/css" href="../../../css/bootstrap.min.css">
        <link rel="stylesheet" type="text/css" href="../../../css/bootstrap-theme.min.css">
        <link rel="stylesheet" type="text/css" href="../../../css/sami.css">

        <meta name="MobileOptimized" content="width">
        <meta name="HandheldFriendly" content="true">
        <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">

                <form id="search-form" action="../../../search.html" method="GET">

            <input name="search"
                   class="typeahead form-control"
                   type="search"
                   placeholder="Search">
        </form>

                <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-elements">
                    Toggle navigation

                </button>
                Thelia 2 API

Classes

Namespaces

Interfaces

Traits

Index

Search

class

Thelia

Model

Base

Profile

Profile

    class
    Profile        implements
        ActiveRecordInterface

Constants

                TABLE_MAP

TableMap class name

Methods

                    __construct()

Initializes internal state of Thelia\Model\Base\Profile object.

    boolean

                    isModified()

Returns whether the object has been modified.

    boolean

                    isColumnModified(
    string $col)

Has specified column been modified?

    array

                    getModifiedColumns()

Get the columns that have been modified in this object.

    boolean

                    isNew()

Returns whether the object has ever been saved.  This will
be false, if the object was retrieved from storage or was created
and then saved.

                    setNew(
    boolean $b)

Setter for the isNew attribute.  This method will be called
by Propel-generated children and objects.

    boolean

                    isDeleted()

Whether this object has been deleted.

    void

                    setDeleted(
    boolean $b)

Specify whether this object has been deleted.

    void

                    resetModified(
    string $col = null)

Sets the modified state for the object to be false.

    boolean

                    equals(
    mixed $obj)

Compares this with another Profile instance.  If
obj is an instance of Profile, delegates to
equals(Profile).  Otherwise, returns false.

    int

                    hashCode()

If the primary key is not null, return the hashcode of the
primary key. Otherwise, return the hash code of the object.

    array

                    getVirtualColumns()

Get the associative array of the virtual columns in this object

    boolean

                    hasVirtualColumn(
    string $name)

Checks the existence of a virtual column in this object

    mixed

                    getVirtualColumn(
    string $name)

Get the value of a virtual column in this object

    Profile

                    setVirtualColumn(
    string $name,
    mixed $value)

Set the value of a virtual column in this object

    Profile

                    importFrom(
    mixed $parser,
    string $data)

Populate the current object from a string, using a given parser format

$book = new Book();
$book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

    string

                    exportTo(
    mixed $parser,
    boolean $includeLazyLoadColumns = true)

Export the current object properties to a string, using a given parser format

$book = BookQuery::create()->findPk(9012);
echo $book->exportTo('JSON');
 => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

                    __sleep()

Clean up internal collections prior to serializing
Avoids recursive loops that turn into segmentation faults when serializing

    int

                    getId()

Get the [id] column value.

    string

                    getCode()

Get the [code] column value.

    mixed

                    getCreatedAt(
    string $format = NULL)

Get the [optionally formatted] temporal [created_at] column value.

    mixed

                    getUpdatedAt(
    string $format = NULL)

Get the [optionally formatted] temporal [updated_at] column value.

    Profile

                    setId(
    int $v)

Set the value of [id] column.

    Profile

                    setCode(
    string $v)

Set the value of [code] column.

    Profile

                    setCreatedAt(
    mixed $v)

Sets the value of [created_at] column to a normalized version of the date/time value specified.

    Profile

                    setUpdatedAt(
    mixed $v)

Sets the value of [updated_at] column to a normalized version of the date/time value specified.

    boolean

                    hasOnlyDefaultValues()

Indicates whether the columns in this object are only set to default values.

    int

                    hydrate(
    array $row,
    int $startcol,
    boolean $rehydrate = false,
    string $indexType = TableMap::TYPE_NUM)

Hydrates (populates) the object variables with values from the database resultset.

                    ensureConsistency()

Checks and repairs the internal consistency of the object.

    void

                    reload(
    boolean $deep = false,
    ConnectionInterface $con = null)

Reloads this object from datastore based on primary key and (optionally) resets all associated objects.

    void

                    delete(
    ConnectionInterface $con = null)

Removes this object from datastore and sets delete attribute.

    int

                    save(
    ConnectionInterface $con = null)

Persists this object to the database.

    mixed

                    getByName(
    string $name,
    string $type = TableMap::TYPE_PHPNAME)

Retrieves a field from the object by name passed in as a string.

    mixed

                    getByPosition(
    int $pos)

Retrieves a field from the object by Position as specified in the xml schema.

    array

                    toArray(
    string $keyType = TableMap::TYPE_PHPNAME,
    boolean $includeLazyLoadColumns = true,
    array $alreadyDumpedObjects = array(),
    boolean $includeForeignObjects = false)

Exports the object as an array.

    void

                    setByName(
    string $name,
    mixed $value,
    string $type = TableMap::TYPE_PHPNAME)

Sets a field from the object by name passed in as a string.

    void

                    setByPosition(
    int $pos,
    mixed $value)

Sets a field from the object by Position as specified in the xml schema.

    void

                    fromArray(
    array $arr,
    string $keyType = TableMap::TYPE_PHPNAME)

Populates the object using an array.

    Criteria

                    buildCriteria()

Build a Criteria object containing the values of all modified columns in this object.

    Criteria

                    buildPkeyCriteria()

Builds a Criteria object containing the primary key for this object.

    int

                    getPrimaryKey()

Returns the primary key for this object (row).

    void

                    setPrimaryKey(
    int $key)

Generic method to set the primary key (id column).

    boolean

                    isPrimaryKeyNull()

Returns true if the primary key for this object is null.

                    copyInto(
    object $copyObj,
    boolean $deepCopy = false,
    boolean $makeNew = true)

Sets contents of passed object to values from current object.

    Profile

                    copy(
    boolean $deepCopy = false)

Makes a copy of this object that will be inserted as a new row in table when saved.

    void

                    initRelation(
    string $relationName)

Initializes a collection based on the name of a relation.

    void

                    clearAdmins()

Clears out the collAdmins collection

                    resetPartialAdmins($v = true)

Reset is the collAdmins collection loaded partially.

    void

                    initAdmins(
    boolean $overrideExisting = true)

Initializes the collAdmins collection.

    Collection|Admin[]

                    getAdmins(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildAdmin objects which contain a foreign key that references this object.

    Profile

                    setAdmins(
    Collection $admins,
    ConnectionInterface $con = null)

Sets a collection of Admin objects related by a one-to-many relationship
to the current object.

    int

                    countAdmins(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related Admin objects.

    Profile

                    addAdmin(
    Admin $l)

Method called to associate a ChildAdmin object to this object
through the ChildAdmin foreign key attribute.

    Profile

                    removeAdmin(
    Admin $admin)

No description

    void

                    clearProfileResources()

Clears out the collProfileResources collection

                    resetPartialProfileResources($v = true)

Reset is the collProfileResources collection loaded partially.

    void

                    initProfileResources(
    boolean $overrideExisting = true)

Initializes the collProfileResources collection.

    Collection|ProfileResource[]

                    getProfileResources(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildProfileResource objects which contain a foreign key that references this object.

    Profile

                    setProfileResources(
    Collection $profileResources,
    ConnectionInterface $con = null)

Sets a collection of ProfileResource objects related by a one-to-many relationship
to the current object.

    int

                    countProfileResources(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related ProfileResource objects.

    Profile

                    addProfileResource(
    ProfileResource $l)

Method called to associate a ChildProfileResource object to this object
through the ChildProfileResource foreign key attribute.

    Profile

                    removeProfileResource(
    ProfileResource $profileResource)

No description

    Collection|ProfileResource[]

                    getProfileResourcesJoinResource(
    Criteria $criteria = null,
    ConnectionInterface $con = null,
    string $joinBehavior = Criteria::LEFT_JOIN)

If this collection has already been initialized with
an identical criteria, it returns the collection.

    void

                    clearProfileModules()

Clears out the collProfileModules collection

                    resetPartialProfileModules($v = true)

Reset is the collProfileModules collection loaded partially.

    void

                    initProfileModules(
    boolean $overrideExisting = true)

Initializes the collProfileModules collection.

    Collection|ProfileModule[]

                    getProfileModules(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildProfileModule objects which contain a foreign key that references this object.

    Profile

                    setProfileModules(
    Collection $profileModules,
    ConnectionInterface $con = null)

Sets a collection of ProfileModule objects related by a one-to-many relationship
to the current object.

    int

                    countProfileModules(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related ProfileModule objects.

    Profile

                    addProfileModule(
    ProfileModule $l)

Method called to associate a ChildProfileModule object to this object
through the ChildProfileModule foreign key attribute.

    Profile

                    removeProfileModule(
    ProfileModule $profileModule)

No description

    Collection|ProfileModule[]

                    getProfileModulesJoinModule(
    Criteria $criteria = null,
    ConnectionInterface $con = null,
    string $joinBehavior = Criteria::LEFT_JOIN)

If this collection has already been initialized with
an identical criteria, it returns the collection.

    void

                    clearApis()

Clears out the collApis collection

                    resetPartialApis($v = true)

Reset is the collApis collection loaded partially.

    void

                    initApis(
    boolean $overrideExisting = true)

Initializes the collApis collection.

    Collection|Api[]

                    getApis(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildApi objects which contain a foreign key that references this object.

    Profile

                    setApis(
    Collection $apis,
    ConnectionInterface $con = null)

Sets a collection of Api objects related by a one-to-many relationship
to the current object.

    int

                    countApis(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related Api objects.

    Profile

                    addApi(
    Api $l)

Method called to associate a ChildApi object to this object
through the ChildApi foreign key attribute.

    Profile

                    removeApi(
    Api $api)

No description

    void

                    clearProfileI18ns()

Clears out the collProfileI18ns collection

                    resetPartialProfileI18ns($v = true)

Reset is the collProfileI18ns collection loaded partially.

    void

                    initProfileI18ns(
    boolean $overrideExisting = true)

Initializes the collProfileI18ns collection.

    Collection|ProfileI18n[]

                    getProfileI18ns(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildProfileI18n objects which contain a foreign key that references this object.

    Profile

                    setProfileI18ns(
    Collection $profileI18ns,
    ConnectionInterface $con = null)

Sets a collection of ProfileI18n objects related by a one-to-many relationship
to the current object.

    int

                    countProfileI18ns(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related ProfileI18n objects.

    Profile

                    addProfileI18n(
    ProfileI18n $l)

Method called to associate a ChildProfileI18n object to this object
through the ChildProfileI18n foreign key attribute.

    Profile

                    removeProfileI18n(
    ProfileI18n $profileI18n)

No description

    void

                    clearResources()

Clears out the collResources collection

    void

                    initResources()

Initializes the collResources collection.

    ObjectCollection|Resource[]

                    getResources(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets a collection of ChildResource objects related by a many-to-many relationship
to the current object by way of the profile_resource cross-reference table.

    Profile

                    setResources(
    Collection $resources,
    ConnectionInterface $con = null)

Sets a collection of Resource objects related by a many-to-many relationship
to the current object by way of the profile_resource cross-reference table.

    int

                    countResources(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Gets the number of ChildResource objects related by a many-to-many relationship
to the current object by way of the profile_resource cross-reference table.

    Profile

                    addResource(
    Resource $resource)

Associate a ChildResource object to this object
through the profile_resource cross reference table.

    Profile

                    removeResource(
    Resource $resource)

Remove a ChildResource object to this object
through the profile_resource cross reference table.

                    clear()

Clears the current object and sets all attributes to their default values

                    clearAllReferences(
    boolean $deep = false)

Resets all references to other model objects or collections of model objects.

    string

                    __toString()

Return the string representation of this object

    Profile

                    keepUpdateDateUnchanged()

Mark the current object so that the update date doesn't get updated during next save

    Profile

                    setLocale(
    string $locale = 'en_US')

Sets the locale for translations

    string

                    getLocale()

Gets the locale for translations

    ProfileI18n

                    getTranslation(
    string $locale = 'en_US',
    ConnectionInterface $con = null)

Returns the current translation for a given locale

    Profile

                    removeTranslation(
    string $locale = 'en_US',
    ConnectionInterface $con = null)

Remove the translation for a given locale

    ProfileI18n

                    getCurrentTranslation(
    ConnectionInterface $con = null)

Returns the current translation

    string

                    getTitle()

Get the [title] column value.

    ProfileI18n

                    setTitle(
    string $v)

Set the value of [title] column.

    string

                    getDescription()

Get the [description] column value.

    ProfileI18n

                    setDescription(
    string $v)

Set the value of [description] column.

    string

                    getChapo()

Get the [chapo] column value.

    ProfileI18n

                    setChapo(
    string $v)

Set the value of [chapo] column.

    string

                    getPostscriptum()

Get the [postscriptum] column value.

    ProfileI18n

                    setPostscriptum(
    string $v)

Set the value of [postscriptum] column.

    boolean

                    preSave(
    ConnectionInterface $con = null)

Code to be run before persisting the object

                    postSave(
    ConnectionInterface $con = null)

Code to be run after persisting the object

    boolean

                    preInsert(
    ConnectionInterface $con = null)

Code to be run before inserting to database

                    postInsert(
    ConnectionInterface $con = null)

Code to be run after inserting to database

    boolean

                    preUpdate(
    ConnectionInterface $con = null)

Code to be run before updating the object in database

                    postUpdate(
    ConnectionInterface $con = null)

Code to be run after updating the object in database

    boolean

                    preDelete(
    ConnectionInterface $con = null)

Code to be run before deleting the object in database

                    postDelete(
    ConnectionInterface $con = null)

Code to be run after deleting the object in database

    array|string

                    __call(
    string $name,
    mixed $params)

Derived method to catches calls to undefined methods.

Details

at line 190

    __construct()

Initializes internal state of Thelia\Model\Base\Profile object.

at line 199

    boolean
    isModified()

Returns whether the object has been modified.

Return Value

    boolean
            True if the object has been modified.

at line 210

    boolean
    isColumnModified(
    string $col)

Has specified column been modified?

Parameters

    string
                $col
                column fully qualified name (TableMap::TYPECOLNAME), e.g. Book::AUTHORID

Return Value

    boolean
            True if $col has been modified.

at line 219

    array
    getModifiedColumns()

Get the columns that have been modified in this object.

Return Value

    array
            A unique list of the modified column names for this object.

at line 231

    boolean
    isNew()

Returns whether the object has ever been saved.  This will
be false, if the object was retrieved from storage or was created
and then saved.

Return Value

    boolean
            true, if the object has never been persisted.

at line 242

    setNew(
    boolean $b)

Setter for the isNew attribute.  This method will be called
by Propel-generated children and objects.

Parameters

    boolean
                $b
                the state of the object.

at line 251

    boolean
    isDeleted()

Whether this object has been deleted.

Return Value

    boolean
            The deleted state of this object.

at line 261

    void
    setDeleted(
    boolean $b)

Specify whether this object has been deleted.

Parameters

    boolean
                $b
                The deleted state of this object.

Return Value

    void

at line 271

    void
    resetModified(
    string $col = null)

Sets the modified state for the object to be false.

Parameters

    string
                $col
                If supplied, only the specified column is reset.

Return Value

    void

at line 290

    boolean
    equals(
    mixed $obj)

Compares this with another Profile instance.  If
obj is an instance of Profile, delegates to
equals(Profile).  Otherwise, returns false.

Parameters

    mixed
                $obj
                The object to compare to.

Return Value

    boolean
            Whether equal to the object specified.

at line 315

    int
    hashCode()

If the primary key is not null, return the hashcode of the
primary key. Otherwise, return the hash code of the object.

Return Value

    int
            Hashcode

at line 329

    array
    getVirtualColumns()

Get the associative array of the virtual columns in this object

Return Value

    array

at line 340

    boolean
    hasVirtualColumn(
    string $name)

Checks the existence of a virtual column in this object

Parameters

    string
                $name
                The virtual column name

Return Value

    boolean

at line 353

    mixed
    getVirtualColumn(
    string $name)

Get the value of a virtual column in this object

Parameters

    string
                $name
                The virtual column name

Return Value

    mixed

Exceptions

                PropelException

at line 370

    Profile
    setVirtualColumn(
    string $name,
    mixed $value)

Set the value of a virtual column in this object

Parameters

    string
                $name
                The virtual column name

    mixed
                $value
                The value to give to the virtual column

Return Value

    Profile
            The current object, for fluid interface

at line 402

    Profile
    importFrom(
    mixed $parser,
    string $data)

Populate the current object from a string, using a given parser format

$book = new Book();
$book->importFrom('JSON', '{"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

Parameters

    mixed
                $parser
                A AbstractParser instance,
                      or a format name ('XML', 'YAML', 'JSON', 'CSV')

    string
                $data
                The source data to import from

Return Value

    Profile
            The current object, for fluid interface

at line 425

    string
    exportTo(
    mixed $parser,
    boolean $includeLazyLoadColumns = true)

Export the current object properties to a string, using a given parser format

$book = BookQuery::create()->findPk(9012);
echo $book->exportTo('JSON');
 => {"Id":9012,"Title":"Don Juan","ISBN":"0140422161","Price":12.99,"PublisherId":1234,"AuthorId":5678}');

Parameters

    mixed
                $parser
                A AbstractParser instance, or a format name ('XML', 'YAML', 'JSON', 'CSV')

    boolean
                $includeLazyLoadColumns
                (optional) Whether to include lazy load(ed) columns. Defaults to TRUE.

Return Value

    string
            The exported data

at line 438

    __sleep()

Clean up internal collections prior to serializing
Avoids recursive loops that turn into segmentation faults when serializing

at line 450

    int
    getId()

Get the [id] column value.

Return Value

    int

at line 461

    string
    getCode()

Get the [code] column value.

Return Value

    string

at line 478

    mixed
    getCreatedAt(
    string $format = NULL)

Get the [optionally formatted] temporal [created_at] column value.

Parameters

    string
                $format
                The date/time format string (either date()-style or strftime()-style).
                           If format is NULL, then the raw \DateTime object will be returned.

Return Value

    mixed
            Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00

Exceptions

                PropelException

if unable to parse/validate the date/time value.

at line 498

    mixed
    getUpdatedAt(
    string $format = NULL)

Get the [optionally formatted] temporal [updated_at] column value.

Parameters

    string
                $format
                The date/time format string (either date()-style or strftime()-style).
                           If format is NULL, then the raw \DateTime object will be returned.

Return Value

    mixed
            Formatted date/time value as string or \DateTime object (if format is NULL), NULL if column is NULL, and 0 if column value is 0000-00-00 00:00:00

Exceptions

                PropelException

if unable to parse/validate the date/time value.

at line 513

    Profile
    setId(
    int $v)

Set the value of [id] column.

Parameters

    int
                $v
                new value

Return Value

    Profile
            The current object (for fluent API support)

at line 534

    Profile
    setCode(
    string $v)

Set the value of [code] column.

Parameters

    string
                $v
                new value

Return Value

    Profile
            The current object (for fluent API support)

at line 556

    Profile
    setCreatedAt(
    mixed $v)

Sets the value of [created_at] column to a normalized version of the date/time value specified.

Parameters

    mixed
                $v
                string, integer (timestamp), or \DateTime value.
              Empty strings are treated as NULL.

Return Value

    Profile
            The current object (for fluent API support)

at line 577

    Profile
    setUpdatedAt(
    mixed $v)

Sets the value of [updated_at] column to a normalized version of the date/time value specified.

Parameters

    mixed
                $v
                string, integer (timestamp), or \DateTime value.
              Empty strings are treated as NULL.

Return Value

    Profile
            The current object (for fluent API support)

at line 599

    boolean
    hasOnlyDefaultValues()

Indicates whether the columns in this object are only set to default values.

This method can be used in conjunction with isModified() to indicate whether an object is both
modified and has some values set which are non-default.

Return Value

    boolean
            Whether the columns in this object are only been set with default values.

at line 623

    int
    hydrate(
    array $row,
    int $startcol,
    boolean $rehydrate = false,
    string $indexType = TableMap::TYPE_NUM)

Hydrates (populates) the object variables with values from the database resultset.

An offset (0-based "start column") is specified so that objects can be hydrated
with a subset of the columns in the resultset rows.  This is needed, for example,
for results of JOIN queries where the resultset row includes columns from two or
more tables.

Parameters

    array
                $row
                The row returned by DataFetcher->fetch().

    int
                $startcol
                0-based offset column which indicates which restultset column to start with.

    boolean
                $rehydrate
                Whether this object is being re-hydrated from the database.

    string
                $indexType
                The index type of $row. Mostly DataFetcher->getIndexType().
One of the class type constants TableMap::TYPEPHPNAME, TableMap::TYPESTUDLYPHPNAME
                           TableMap::TYPECOLNAME, TableMap::TYPEFIELDNAME, TableMap::TYPE_NUM.

Return Value

    int
            next starting column

Exceptions

                PropelException

Any caught Exception will be rewrapped as a PropelException.

at line 673

    ensureConsistency()

Checks and repairs the internal consistency of the object.

This method is executed after an already-instantiated object is re-hydrated
from the database.  It exists to check any foreign keys to make sure that
the objects related to the current object are correct based on foreign key.

You can override this method in the stub class, but you should always invoke
the base method from the overridden method (i.e. parent::ensureConsistency()),
in case your model changes.

Exceptions

                PropelException

at line 687

    void
    reload(
    boolean $deep = false,
    ConnectionInterface $con = null)

Reloads this object from datastore based on primary key and (optionally) resets all associated objects.

This will only work if the object has been saved and has a valid primary key set.

Parameters

    boolean
                $deep
                (optional) Whether to also de-associated any related objects.

    ConnectionInterface
                $con
                (optional) The ConnectionInterface connection to use.

Return Value

    void

Exceptions

                PropelException

if this object is deleted, unsaved or doesn't have pk match in db

at line 737

    void
    delete(
    ConnectionInterface $con = null)

Removes this object from datastore and sets delete attribute.

Parameters

    ConnectionInterface
                $con

Return Value

    void

Exceptions

                PropelException

See also

                Profile::setDeleted()

                Profile::isDeleted()

at line 779

    int
    save(
    ConnectionInterface $con = null)

Persists this object to the database.

If the object is new, it inserts it; otherwise an update is performed.
All modified related objects will also be persisted in the doSave()
method.  This method wraps all precipitate database operations in a
single transaction.

Parameters

    ConnectionInterface
                $con

Return Value

    int
            The number of rows affected by this insert/update and any referring fk objects' save() operations.

Exceptions

                PropelException

See also

                doSave()

at line 1077

    mixed
    getByName(
    string $name,
    string $type = TableMap::TYPE_PHPNAME)

Retrieves a field from the object by name passed in as a string.

Parameters

    string
                $name
                name

    string
                $type
                The type of fieldname the $name is of:
                    one of the class type constants TableMap::TYPEPHPNAME, TableMap::TYPESTUDLYPHPNAME
                    TableMap::TYPECOLNAME, TableMap::TYPEFIELDNAME, TableMap::TYPENUM.
                    Defaults to TableMap::TYPEPHPNAME.

Return Value

    mixed
            Value of field.

at line 1092

    mixed
    getByPosition(
    int $pos)

Retrieves a field from the object by Position as specified in the xml schema.

Zero-based.

Parameters

    int
                $pos
                position in xml schema

Return Value

    mixed
            Value of field at $pos

at line 1128

    array
    toArray(
    string $keyType = TableMap::TYPE_PHPNAME,
    boolean $includeLazyLoadColumns = true,
    array $alreadyDumpedObjects = array(),
    boolean $includeForeignObjects = false)

Exports the object as an array.

You can specify the key type of the array by passing one of the class
type constants.

Parameters

    string
                $keyType
                (optional) One of the class type constants TableMap::TYPEPHPNAME, TableMap::TYPESTUDLYPHPNAME,
                   TableMap::TYPECOLNAME, TableMap::TYPEFIELDNAME, TableMap::TYPENUM.
                   Defaults to TableMap::TYPEPHPNAME.

    boolean
                $includeLazyLoadColumns
                (optional) Whether to include lazy loaded columns. Defaults to TRUE.

    array
                $alreadyDumpedObjects
                List of objects to skip to avoid recursion

    boolean
                $includeForeignObjects
                (optional) Whether to include hydrated related objects. Default to FALSE.

Return Value

    array
            an associative array containing the field names (as keys) and field values

at line 1178

    void
    setByName(
    string $name,
    mixed $value,
    string $type = TableMap::TYPE_PHPNAME)

Sets a field from the object by name passed in as a string.

Parameters

    string
                $name

    mixed
                $value
                field value

    string
                $type
                The type of fieldname the $name is of:
                    one of the class type constants TableMap::TYPEPHPNAME, TableMap::TYPESTUDLYPHPNAME
                    TableMap::TYPECOLNAME, TableMap::TYPEFIELDNAME, TableMap::TYPENUM.
                    Defaults to TableMap::TYPEPHPNAME.

Return Value

    void

at line 1193

    void
    setByPosition(
    int $pos,
    mixed $value)

Sets a field from the object by Position as specified in the xml schema.

Zero-based.

Parameters

    int
                $pos
                position in xml schema

    mixed
                $value
                field value

Return Value

    void

at line 1228

    void
    fromArray(
    array $arr,
    string $keyType = TableMap::TYPE_PHPNAME)

Populates the object using an array.

This is particularly useful when populating an object from one of the
request arrays (e.g. $_POST).  This method goes through the column
names, checking to see whether a matching key exists in populated
array. If so the setByName() method is called for that column.

You can specify the key type of the array by additionally passing one
of the class type constants TableMap::TYPEPHPNAME, TableMap::TYPESTUDLYPHPNAME,
TableMap::TYPECOLNAME, TableMap::TYPEFIELDNAME, TableMap::TYPENUM.
The default key type is the column's TableMap::TYPEPHPNAME.

Parameters

    array
                $arr
                An array to populate the object from.

    string
                $keyType
                The type of keys the array uses.

Return Value

    void

at line 1243

    Criteria
    buildCriteria()

Build a Criteria object containing the values of all modified columns in this object.

Return Value

    Criteria
            The Criteria object containing all modified values.

at line 1263

    Criteria
    buildPkeyCriteria()

Builds a Criteria object containing the primary key for this object.

Unlike buildCriteria() this method includes the primary key values regardless
of whether or not they have been modified.

Return Value

    Criteria
            The Criteria object containing value(s) for primary key(s).

at line 1275

    int
    getPrimaryKey()

Returns the primary key for this object (row).

Return Value

    int

at line 1286

    void
    setPrimaryKey(
    int $key)

Generic method to set the primary key (id column).

Parameters

    int
                $key
                Primary key.

Return Value

    void

at line 1295

    boolean
    isPrimaryKeyNull()

Returns true if the primary key for this object is null.

Return Value

    boolean

at line 1312

    copyInto(
    object $copyObj,
    boolean $deepCopy = false,
    boolean $makeNew = true)

Sets contents of passed object to values from current object.

If desired, this method can also make copies of all associated (fkey referrers)
objects.

Parameters

    object
                $copyObj
                An object of \Thelia\Model\Profile (or compatible) type.

    boolean
                $deepCopy
                Whether to also copy all rows that refer (by fkey) to the current row.

    boolean
                $makeNew
                Whether to reset autoincrement PKs and make the object new.

Exceptions

                PropelException

at line 1373

    Profile
    copy(
    boolean $deepCopy = false)

Makes a copy of this object that will be inserted as a new row in table when saved.

It creates a new object filling in the simple attributes, but skipping any primary
keys that are defined for the table.

If desired, this method can also make copies of all associated (fkey referrers)
objects.

Parameters

    boolean
                $deepCopy
                Whether to also copy all rows that refer (by fkey) to the current row.

Return Value

    Profile
            Clone of current object.

Exceptions

                PropelException

at line 1392

    void
    initRelation(
    string $relationName)

Initializes a collection based on the name of a relation.

Avoids crafting an 'init[$relationName]s' method name
that wouldn't work when StandardEnglishPluralizer is used.

Parameters

    string
                $relationName
                The name of the relation to initialize

Return Value

    void

at line 1420

    void
    clearAdmins()

Clears out the collAdmins collection

This does not modify the database; however, it will remove any associated objects, causing
them to be refetched by subsequent calls to accessor method.

Return Value

    void

See also

                addAdmins()

at line 1428

    resetPartialAdmins($v = true)

Reset is the collAdmins collection loaded partially.

Parameters

                $v

at line 1445

    void
    initAdmins(
    boolean $overrideExisting = true)

Initializes the collAdmins collection.

By default this just sets the collAdmins collection to an empty array (like clearcollAdmins());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.

Parameters

    boolean
                $overrideExisting
                If set to true, the method call initializes
                                       the collection even if it is not empty

Return Value

    void

at line 1468

    Collection|Admin[]
    getAdmins(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildAdmin objects which contain a foreign key that references this object.

If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildProfile is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

Return Value

    Collection|Admin[]
            List of ChildAdmin objects

Exceptions

                PropelException

at line 1524

    Profile
    setAdmins(
    Collection $admins,
    ConnectionInterface $con = null)

Sets a collection of Admin objects related by a one-to-many relationship
to the current object.

It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.

Parameters

    Collection
                $admins
                A Propel collection.

    ConnectionInterface
                $con
                Optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 1555

    int
    countAdmins(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related Admin objects.

Parameters

    Criteria
                $criteria

    boolean
                $distinct

    ConnectionInterface
                $con

Return Value

    int
            Count of related Admin objects.

Exceptions

                PropelException

at line 1587

    Profile
    addAdmin(
    Admin $l)

Method called to associate a ChildAdmin object to this object
through the ChildAdmin foreign key attribute.

Parameters

    Admin
                $l
                ChildAdmin

Return Value

    Profile
            The current object (for fluent API support)

at line 1614

    Profile
    removeAdmin(
    Admin $admin)

Parameters

    Admin
                $admin
                The admin object to remove.

Return Value

    Profile
            The current object (for fluent API support)

at line 1638

    void
    clearProfileResources()

Clears out the collProfileResources collection

This does not modify the database; however, it will remove any associated objects, causing
them to be refetched by subsequent calls to accessor method.

Return Value

    void

See also

                addProfileResources()

at line 1646

    resetPartialProfileResources($v = true)

Reset is the collProfileResources collection loaded partially.

Parameters

                $v

at line 1663

    void
    initProfileResources(
    boolean $overrideExisting = true)

Initializes the collProfileResources collection.

By default this just sets the collProfileResources collection to an empty array (like clearcollProfileResources());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.

Parameters

    boolean
                $overrideExisting
                If set to true, the method call initializes
                                       the collection even if it is not empty

Return Value

    void

at line 1686

    Collection|ProfileResource[]
    getProfileResources(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildProfileResource objects which contain a foreign key that references this object.

If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildProfile is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

Return Value

    Collection|ProfileResource[]
            List of ChildProfileResource objects

Exceptions

                PropelException

at line 1742

    Profile
    setProfileResources(
    Collection $profileResources,
    ConnectionInterface $con = null)

Sets a collection of ProfileResource objects related by a one-to-many relationship
to the current object.

It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.

Parameters

    Collection
                $profileResources
                A Propel collection.

    ConnectionInterface
                $con
                Optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 1776

    int
    countProfileResources(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related ProfileResource objects.

Parameters

    Criteria
                $criteria

    boolean
                $distinct

    ConnectionInterface
                $con

Return Value

    int
            Count of related ProfileResource objects.

Exceptions

                PropelException

at line 1808

    Profile
    addProfileResource(
    ProfileResource $l)

Method called to associate a ChildProfileResource object to this object
through the ChildProfileResource foreign key attribute.

Parameters

    ProfileResource
                $l
                ChildProfileResource

Return Value

    Profile
            The current object (for fluent API support)

at line 1835

    Profile
    removeProfileResource(
    ProfileResource $profileResource)

Parameters

    ProfileResource
                $profileResource
                The profileResource object to remove.

Return Value

    Profile
            The current object (for fluent API support)

at line 1867

    Collection|ProfileResource[]
    getProfileResourcesJoinResource(
    Criteria $criteria = null,
    ConnectionInterface $con = null,
    string $joinBehavior = Criteria::LEFT_JOIN)

If this collection has already been initialized with
an identical criteria, it returns the collection.

Otherwise if this Profile is new, it will return
an empty collection; or if this Profile has previously
been saved, it will retrieve related ProfileResources from storage.

This method is protected by default in order to keep the public
api reasonable.  You can provide public methods for those you
actually need in Profile.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

    string
                $joinBehavior
                optional join type to use (defaults to Criteria::LEFT_JOIN)

Return Value

    Collection|ProfileResource[]
            List of ChildProfileResource objects

at line 1884

    void
    clearProfileModules()

Clears out the collProfileModules collection

This does not modify the database; however, it will remove any associated objects, causing
them to be refetched by subsequent calls to accessor method.

Return Value

    void

See also

                addProfileModules()

at line 1892

    resetPartialProfileModules($v = true)

Reset is the collProfileModules collection loaded partially.

Parameters

                $v

at line 1909

    void
    initProfileModules(
    boolean $overrideExisting = true)

Initializes the collProfileModules collection.

By default this just sets the collProfileModules collection to an empty array (like clearcollProfileModules());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.

Parameters

    boolean
                $overrideExisting
                If set to true, the method call initializes
                                       the collection even if it is not empty

Return Value

    void

at line 1932

    Collection|ProfileModule[]
    getProfileModules(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildProfileModule objects which contain a foreign key that references this object.

If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildProfile is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

Return Value

    Collection|ProfileModule[]
            List of ChildProfileModule objects

Exceptions

                PropelException

at line 1988

    Profile
    setProfileModules(
    Collection $profileModules,
    ConnectionInterface $con = null)

Sets a collection of ProfileModule objects related by a one-to-many relationship
to the current object.

It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.

Parameters

    Collection
                $profileModules
                A Propel collection.

    ConnectionInterface
                $con
                Optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 2022

    int
    countProfileModules(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related ProfileModule objects.

Parameters

    Criteria
                $criteria

    boolean
                $distinct

    ConnectionInterface
                $con

Return Value

    int
            Count of related ProfileModule objects.

Exceptions

                PropelException

at line 2054

    Profile
    addProfileModule(
    ProfileModule $l)

Method called to associate a ChildProfileModule object to this object
through the ChildProfileModule foreign key attribute.

Parameters

    ProfileModule
                $l
                ChildProfileModule

Return Value

    Profile
            The current object (for fluent API support)

at line 2081

    Profile
    removeProfileModule(
    ProfileModule $profileModule)

Parameters

    ProfileModule
                $profileModule
                The profileModule object to remove.

Return Value

    Profile
            The current object (for fluent API support)

at line 2113

    Collection|ProfileModule[]
    getProfileModulesJoinModule(
    Criteria $criteria = null,
    ConnectionInterface $con = null,
    string $joinBehavior = Criteria::LEFT_JOIN)

If this collection has already been initialized with
an identical criteria, it returns the collection.

Otherwise if this Profile is new, it will return
an empty collection; or if this Profile has previously
been saved, it will retrieve related ProfileModules from storage.

This method is protected by default in order to keep the public
api reasonable.  You can provide public methods for those you
actually need in Profile.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

    string
                $joinBehavior
                optional join type to use (defaults to Criteria::LEFT_JOIN)

Return Value

    Collection|ProfileModule[]
            List of ChildProfileModule objects

at line 2130

    void
    clearApis()

Clears out the collApis collection

This does not modify the database; however, it will remove any associated objects, causing
them to be refetched by subsequent calls to accessor method.

Return Value

    void

See also

                addApis()

at line 2138

    resetPartialApis($v = true)

Reset is the collApis collection loaded partially.

Parameters

                $v

at line 2155

    void
    initApis(
    boolean $overrideExisting = true)

Initializes the collApis collection.

By default this just sets the collApis collection to an empty array (like clearcollApis());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.

Parameters

    boolean
                $overrideExisting
                If set to true, the method call initializes
                                       the collection even if it is not empty

Return Value

    void

at line 2178

    Collection|Api[]
    getApis(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildApi objects which contain a foreign key that references this object.

If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildProfile is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

Return Value

    Collection|Api[]
            List of ChildApi objects

Exceptions

                PropelException

at line 2234

    Profile
    setApis(
    Collection $apis,
    ConnectionInterface $con = null)

Sets a collection of Api objects related by a one-to-many relationship
to the current object.

It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.

Parameters

    Collection
                $apis
                A Propel collection.

    ConnectionInterface
                $con
                Optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 2265

    int
    countApis(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related Api objects.

Parameters

    Criteria
                $criteria

    boolean
                $distinct

    ConnectionInterface
                $con

Return Value

    int
            Count of related Api objects.

Exceptions

                PropelException

at line 2297

    Profile
    addApi(
    Api $l)

Method called to associate a ChildApi object to this object
through the ChildApi foreign key attribute.

Parameters

    Api
                $l
                ChildApi

Return Value

    Profile
            The current object (for fluent API support)

at line 2324

    Profile
    removeApi(
    Api $api)

Parameters

    Api
                $api
                The api object to remove.

Return Value

    Profile
            The current object (for fluent API support)

at line 2348

    void
    clearProfileI18ns()

Clears out the collProfileI18ns collection

This does not modify the database; however, it will remove any associated objects, causing
them to be refetched by subsequent calls to accessor method.

Return Value

    void

See also

                addProfileI18ns()

at line 2356

    resetPartialProfileI18ns($v = true)

Reset is the collProfileI18ns collection loaded partially.

Parameters

                $v

at line 2373

    void
    initProfileI18ns(
    boolean $overrideExisting = true)

Initializes the collProfileI18ns collection.

By default this just sets the collProfileI18ns collection to an empty array (like clearcollProfileI18ns());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.

Parameters

    boolean
                $overrideExisting
                If set to true, the method call initializes
                                       the collection even if it is not empty

Return Value

    void

at line 2396

    Collection|ProfileI18n[]
    getProfileI18ns(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets an array of ChildProfileI18n objects which contain a foreign key that references this object.

If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildProfile is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.

Parameters

    Criteria
                $criteria
                optional Criteria object to narrow the query

    ConnectionInterface
                $con
                optional connection object

Return Value

    Collection|ProfileI18n[]
            List of ChildProfileI18n objects

Exceptions

                PropelException

at line 2452

    Profile
    setProfileI18ns(
    Collection $profileI18ns,
    ConnectionInterface $con = null)

Sets a collection of ProfileI18n objects related by a one-to-many relationship
to the current object.

It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.

Parameters

    Collection
                $profileI18ns
                A Propel collection.

    ConnectionInterface
                $con
                Optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 2486

    int
    countProfileI18ns(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Returns the number of related ProfileI18n objects.

Parameters

    Criteria
                $criteria

    boolean
                $distinct

    ConnectionInterface
                $con

Return Value

    int
            Count of related ProfileI18n objects.

Exceptions

                PropelException

at line 2518

    Profile
    addProfileI18n(
    ProfileI18n $l)

Method called to associate a ChildProfileI18n object to this object
through the ChildProfileI18n foreign key attribute.

Parameters

    ProfileI18n
                $l
                ChildProfileI18n

Return Value

    Profile
            The current object (for fluent API support)

at line 2549

    Profile
    removeProfileI18n(
    ProfileI18n $profileI18n)

Parameters

    ProfileI18n
                $profileI18n
                The profileI18n object to remove.

Return Value

    Profile
            The current object (for fluent API support)

at line 2573

    void
    clearResources()

Clears out the collResources collection

This does not modify the database; however, it will remove any associated objects, causing
them to be refetched by subsequent calls to accessor method.

Return Value

    void

See also

                addResources()

at line 2588

    void
    initResources()

Initializes the collResources collection.

By default this just sets the collResources collection to an empty collection (like clearResources());
however, you may wish to override this method in your stub class to provide setting appropriate
to your application -- for example, setting the initial array to the values stored in database.

Return Value

    void

at line 2609

    ObjectCollection|Resource[]
    getResources(
    Criteria $criteria = null,
    ConnectionInterface $con = null)

Gets a collection of ChildResource objects related by a many-to-many relationship
to the current object by way of the profile_resource cross-reference table.

If the $criteria is not null, it is used to always fetch the results from the database.
Otherwise the results are fetched from the database the first time, then cached.
Next time the same method is called without $criteria, the cached collection is returned.
If this ChildProfile is new, it will return
an empty collection or the current collection; the criteria is ignored on a new object.

Parameters

    Criteria
                $criteria
                Optional query object to filter the query

    ConnectionInterface
                $con
                Optional connection object

Return Value

    ObjectCollection|Resource[]
            List of ChildResource objects

at line 2639

    Profile
    setResources(
    Collection $resources,
    ConnectionInterface $con = null)

Sets a collection of Resource objects related by a many-to-many relationship
to the current object by way of the profile_resource cross-reference table.

It will also schedule objects for deletion based on a diff between old objects (aka persisted)
and new objects from the given Propel collection.

Parameters

    Collection
                $resources
                A Propel collection.

    ConnectionInterface
                $con
                Optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 2667

    int
    countResources(
    Criteria $criteria = null,
    boolean $distinct = false,
    ConnectionInterface $con = null)

Gets the number of ChildResource objects related by a many-to-many relationship
to the current object by way of the profile_resource cross-reference table.

Parameters

    Criteria
                $criteria
                Optional query object to filter the query

    boolean
                $distinct
                Set to true to force count distinct

    ConnectionInterface
                $con
                Optional connection object

Return Value

    int
            the number of related ChildResource objects

at line 2694

    Profile
    addResource(
    Resource $resource)

Associate a ChildResource object to this object
through the profile_resource cross reference table.

Parameters

    Resource
                $resource
                The ChildProfileResource object to relate

Return Value

    Profile
            The current object (for fluent API support)

at line 2731

    Profile
    removeResource(
    Resource $resource)

Remove a ChildResource object to this object
through the profile_resource cross reference table.

Parameters

    Resource
                $resource
                The ChildProfileResource object to relate

Return Value

    Profile
            The current object (for fluent API support)

at line 2750

    clear()

Clears the current object and sets all attributes to their default values

at line 2772

    clearAllReferences(
    boolean $deep = false)

Resets all references to other model objects or collections of model objects.

This method is a user-space workaround for PHP's inability to garbage collect
objects with circular references (even in PHP 5.3). This is currently necessary
when using Propel in certain daemon or large-volume/high-memory operations.

Parameters

    boolean
                $deep
                Whether to also clear the references on all referrer objects.

at line 2824

    string
    __toString()

Return the string representation of this object

Return Value

    string

at line 2836

    Profile
    keepUpdateDateUnchanged()

Mark the current object so that the update date doesn't get updated during next save

Return Value

    Profile
            The current object (for fluent API support)

at line 2852

    Profile
    setLocale(
    string $locale = 'en_US')

Sets the locale for translations

Parameters

    string
                $locale
                Locale to use for the translation, e.g. 'fr_FR'

Return Value

    Profile
            The current object (for fluent API support)

at line 2864

    string
    getLocale()

Gets the locale for translations

Return Value

    string
            $locale Locale to use for the translation, e.g. 'fr_FR'

at line 2876

    ProfileI18n
    getTranslation(
    string $locale = 'en_US',
    ConnectionInterface $con = null)

Returns the current translation for a given locale

Parameters

    string
                $locale
                Locale to use for the translation, e.g. 'fr_FR'

    ConnectionInterface
                $con
                an optional connection object

Return Value

    ProfileI18n

at line 2911

    Profile
    removeTranslation(
    string $locale = 'en_US',
    ConnectionInterface $con = null)

Remove the translation for a given locale

Parameters

    string
                $locale
                Locale to use for the translation, e.g. 'fr_FR'

    ConnectionInterface
                $con
                an optional connection object

Return Value

    Profile
            The current object (for fluent API support)

at line 2937

    ProfileI18n
    getCurrentTranslation(
    ConnectionInterface $con = null)

Returns the current translation

Parameters

    ConnectionInterface
                $con
                an optional connection object

Return Value

    ProfileI18n

at line 2948

    string
    getTitle()

Get the [title] column value.

Return Value

    string

at line 2960

    ProfileI18n
    setTitle(
    string $v)

Set the value of [title] column.

Parameters

    string
                $v
                new value

Return Value

    ProfileI18n
            The current object (for fluent API support)

at line 2972

    string
    getDescription()

Get the [description] column value.

Return Value

    string

at line 2984

    ProfileI18n
    setDescription(
    string $v)

Set the value of [description] column.

Parameters

    string
                $v
                new value

Return Value

    ProfileI18n
            The current object (for fluent API support)

at line 2996

    string
    getChapo()

Get the [chapo] column value.

Return Value

    string

at line 3008

    ProfileI18n
    setChapo(
    string $v)

Set the value of [chapo] column.

Parameters

    string
                $v
                new value

Return Value

    ProfileI18n
            The current object (for fluent API support)

at line 3020

    string
    getPostscriptum()

Get the [postscriptum] column value.

Return Value

    string

at line 3032

    ProfileI18n
    setPostscriptum(
    string $v)

Set the value of [postscriptum] column.

Parameters

    string
                $v
                new value

Return Value

    ProfileI18n
            The current object (for fluent API support)

at line 3043

    boolean
    preSave(
    ConnectionInterface $con = null)

Code to be run before persisting the object

Parameters

    ConnectionInterface
                $con

Return Value

    boolean

at line 3052

    postSave(
    ConnectionInterface $con = null)

Code to be run after persisting the object

Parameters

    ConnectionInterface
                $con

at line 3062

    boolean
    preInsert(
    ConnectionInterface $con = null)

Code to be run before inserting to database

Parameters

    ConnectionInterface
                $con

Return Value

    boolean

at line 3071

    postInsert(
    ConnectionInterface $con = null)

Code to be run after inserting to database

Parameters

    ConnectionInterface
                $con

at line 3081

    boolean
    preUpdate(
    ConnectionInterface $con = null)

Code to be run before updating the object in database

Parameters

    ConnectionInterface
                $con

Return Value

    boolean

at line 3090

    postUpdate(
    ConnectionInterface $con = null)

Code to be run after updating the object in database

Parameters

    ConnectionInterface
                $con

at line 3100

    boolean
    preDelete(
    ConnectionInterface $con = null)

Code to be run before deleting the object in database

Parameters

    ConnectionInterface
                $con

Return Value

    boolean

at line 3109

    postDelete(
    ConnectionInterface $con = null)

Code to be run after deleting the object in database

Parameters

    ConnectionInterface
                $con

at line 3126

    array|string
    __call(
    string $name,
    mixed $params)

Derived method to catches calls to undefined methods.

Provides magic import/export method support (fromXML()/toXML(), fromYAML()/toYAML(), etc.).
Allows to define default __call() behavior if you overwrite __call()

Parameters

    string
                $name

    mixed
                $params

Return Value

    array|string

        Generated by Sami, the API Documentation Generator.


text:
<?php

/* UserBundle:Group:show.html.twig */
class __TwigTemplate_a2a2ffd27a9b10015d52a42d4463c0f1e5beed5db1501dd2be46ca5f731dc38b extends Twig_Template
{
    public function __construct(Twig_Environment $env)
    {
        parent::__construct($env);

        // line 1
        try {
            $this->parent = $this->env->loadTemplate("UserBundle::layout.html.twig");
        } catch (Twig_Error_Loader $e) {
            $e->setTemplateFile($this->getTemplateName());
            $e->setTemplateLine(1);

            throw $e;
        }

        $this->blocks = array(
            'fos_user_content' => array($this, 'block_fos_user_content'),
        );
    }

    protected function doGetParent(array $context)
    {
        return "UserBundle::layout.html.twig";
    }

    protected function doDisplay(array $context, array $blocks = array())
    {
        $this->parent->display($context, array_merge($this->blocks, $blocks));
    }

    // line 3
    public function block_fos_user_content($context, array $blocks = array())
    {
        // line 4
        $this->env->loadTemplate("UserBundle:Group:show_content.html.twig")->display($context);
    }

    public function getTemplateName()
    {
        return "UserBundle:Group:show.html.twig";
    }

    public function isTraitable()
    {
        return false;
    }

    public function getDebugInfo()
    {
        return array (  39 => 4,  36 => 3,  11 => 1,);
    }
}

redpajama_set_name: RedPajamaGithub


text:
"""Support for Tuya cameras."""
from __future__ import annotations

from tuya_iot import TuyaDevice, TuyaDeviceManager

from homeassistant.components import ffmpeg
from homeassistant.components.camera import SUPPORT_STREAM, Camera as CameraEntity
from homeassistant.config_entries import ConfigEntry
from homeassistant.core import HomeAssistant, callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect
from homeassistant.helpers.entity_platform import AddEntitiesCallback

from . import HomeAssistantTuyaData
from .base import TuyaEntity
from .const import DOMAIN, TUYA_DISCOVERY_NEW, DPCode

# All descriptions can be found here:
# https://developer.tuya.com/en/docs/iot/standarddescription?id=K9i5ql6waswzq
CAMERAS: tuple[str, ...] = (
    # Smart Camera (including doorbells)
    # https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
    "sp",
)

async def async_setup_entry(
    hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
    """Set up Tuya cameras dynamically through Tuya discovery."""
    hass_data: HomeAssistantTuyaData = hass.data[DOMAIN][entry.entry_id]

    @callback
    def async_discover_device(device_ids: list[str]) -> None:
        """Discover and add a discovered Tuya camera."""
        entities: list[TuyaCameraEntity] = []
        for device_id in device_ids:
            device = hass_data.device_manager.device_map[device_id]
            if device.category in CAMERAS:
                entities.append(TuyaCameraEntity(device, hass_data.device_manager))

        async_add_entities(entities)

    async_discover_device([*hass_data.device_manager.device_map])

    entry.async_on_unload(
        async_dispatcher_connect(hass, TUYA_DISCOVERY_NEW, async_discover_device)
    )

class TuyaCameraEntity(TuyaEntity, CameraEntity):
    """Tuya Camera Entity."""

    def __init__(
        self,
        device: TuyaDevice,
        device_manager: TuyaDeviceManager,
    ) -> None:
        """Init Tuya Camera."""
        super().__init__(device, device_manager)
        CameraEntity.__init__(self)

    @property
    def supported_features(self) -> int:
        """Flag supported features."""
        return SUPPORT_STREAM

    @property
    def is_recording(self) -> bool:
        """Return true if the device is recording."""
        return self.device.status.get(DPCode.RECORD_SWITCH, False)

    @property
    def brand(self) -> str | None:
        """Return the camera brand."""
        return "Tuya"

    @property
    def motion_detection_enabled(self) -> bool:
        """Return the camera motion detection status."""
        return self.device.status.get(DPCode.MOTION_SWITCH, False)

    async def stream_source(self) -> str | None:
        """Return the source of the stream."""

        def _stream_source() -> str | None:
            # This method can be replaced by the following snippet, once
            # upstream changes have been merged.
            #
            #   return self.device_manager.get_device_stream_allocate(
            #       self.device.id, stream_type="rtsp"
            #   )
            #
            # https://github.com/tuya/tuya-iot-python-sdk/pull/28

            response = self.device_manager.api.post(
                f"/v1.0/devices/{self.device.id}/stream/actions/allocate",
                {"type": "rtsp"},
            )
            if response["success"]:
                return response["result"]["url"]
            return None

        return await self.hass.async_add_executor_job(_stream_source)

    async def async_camera_image(
        self, width: int | None = None, height: int | None = None
    ) -> bytes | None:
        """Return a still image response from the camera."""
        stream_source = await self.stream_source()
        if not stream_source:
            return None
        return await ffmpeg.async_get_image(
            self.hass,
            stream_source,
            width=width,
            height=height,
        )

    @property
    def model(self) -> str | None:
        """Return the camera model."""
        return self.device.product_name

    def enable_motion_detection(self) -> None:
        """Enable motion detection in the camera."""
        self._send_command([{"code": DPCode.MOTION_SWITCH, "value": True}])

    def disable_motion_detection(self) -> None:
        """Disable motion detection in camera."""
        self._send_command([{"code": DPCode.MOTION_SWITCH, "value": False}])


text:
//
// Created by Yurii Shyrma on 18.12.2017.
//

#ifndef LIBND4J_BIDIAGONALUP_H
#define LIBND4J_BIDIAGONALUP_H
#include <array/NDArray.h>
#include <helpers/hhSequence.h>

namespace sd {
namespace ops {
namespace helpers {

class BiDiagonalUp {
 public:
  NDArray _HHmatrix;  // 2D Householder matrix
  NDArray _HHbidiag;  // vector which contains Householder coefficients
  NDArray _hhCoeffs;  // vector of Householder coefficients

  /**
   *  constructor
   *
   *  matrix - input matrix expected to be bi-diagonalized, remains unaffected
   */
  BiDiagonalUp(const NDArray& matrix);

  /**
   *  this method evaluates data (coeff, normX, tail) used in Householder transformation
   *  formula for Householder matrix: P = identity_matrix - coeff * w * w^T
   *  P * x = [normX, 0, 0 , 0, ...]
   *  coeff - scalar
   *  w = [1, w1, w2, w3, ...], "tail" is w except first unity element, that is "tail" = [w1, w2, w3, ...]
   *  tail and coeff are stored in _HHmatrix
   *  normX are stored in _HHbidiag
   */
  template <typename T>
  void _evalData();

  void evalData();

  /**
   *  this method evaluates product of Householder sequence matrices (transformations) acting on columns
   *
   *  type - type of sequence, type = 'u' (acting on columns) or type = 'v' (acting on rows)
   */
  template <typename T>
  HHsequence makeHHsequence_(const char type);

  HHsequence makeHHsequence(const char type);
};

}  // namespace helpers
}  // namespace ops
}  // namespace sd

#endif  // LIBND4J_BIDIAGONALUP_H


text:
package streamflow.datastore.mongodb.impl;

import com.github.fakemongo.junit.FongoRule;
import java.util.List;
import streamflow.model.kafka.KafkaCluster;
import streamflow.model.test.IntegrationTest;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;

@Category(IntegrationTest.class)
public class MongoKafkaDaoTest {

    @Rule
    public FongoRule fongoRule = new FongoRule();

    private MongoKafkaDao kafkaDao;

    @Before
    public void setUp() {
        Datastore datastore = new Morphia().createDatastore(fongoRule.getMongo(), "streamflow");

        kafkaDao = new MongoKafkaDao(datastore);

        KafkaCluster kafkaCluster1 = new KafkaCluster();
        kafkaCluster1.setId("first-cluster");
        kafkaCluster1.setName("First Cluster");

        KafkaCluster kafkaCluster2 = new KafkaCluster();
        kafkaCluster2.setId("second-cluster");
        kafkaCluster2.setName("Second Cluster");

        KafkaCluster kafkaCluster3 = new KafkaCluster();
        kafkaCluster3.setId("third-cluster");
        kafkaCluster3.setName("Third Cluster");

        kafkaDao.save(kafkaCluster3);
        kafkaDao.save(kafkaCluster1);
        kafkaDao.save(kafkaCluster2);
    }

    @Test
    public void findAllKafkaClusters() {
        List<KafkaCluster> kafkaClusters = kafkaDao.findAll();

        assertEquals("There should be 3 kafka clusters in the datastore", 3, kafkaClusters.size());

        // Check proper sorting of the elements by label
        assertEquals("The first item in the cluster list should have and id of \"first\"",
                "first-cluster", kafkaClusters.get(0).getId());
        assertEquals("The second item in the cluster list should have and id of \"second\"",
                "second-cluster", kafkaClusters.get(1).getId());
        assertEquals("The third item in the cluster list should have and id of \"third\"",
                "third-cluster", kafkaClusters.get(2).getId());
    }

    @Test
    public void findKafkaClusterByName() {
        KafkaCluster validCluster = kafkaDao.findByName("First Cluster");

        assertNotNull("The returned cluster should not be null with valid query values", validCluster);

        KafkaCluster invalidCluster = kafkaDao.findByName("Invalid Cluster");

        assertNull("The returned component should be null with invalid query values", invalidCluster);
    }
}


text:
<?php

namespace EventRequest\UserBundle\Entity;

use FOS\UserBundle\Model\User as BaseUser;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\Table(name="user")
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="type", type="string")
 * @ORM\DiscriminatorMap({"client" = "Client", "manager" = "Manager"})
 */
abstract class User extends BaseUser
{
    const ROLE_CLIENT = 'ROLE_CLIENT';
    const ROLE_MANAGER = 'ROLE_MANAGER';

    /**
     * @ORM\Id
     * @ORM\Column(type="integer")
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    protected $id;

    public function __construct()
    {
        parent::__construct();
    }

    /**
     * @param mixed $id
     */
    public function setId($id)
    {
        $this->id = $id;
    }

    /**
     * @return mixed
     */
    public function getId()
    {
        return $this->id;
    }
}


text:
package org.asynchttpclient;

import static org.testng.Assert.assertNotNull;

import org.asynchttpclient.AsyncHttpClient;
import org.testng.annotations.Test;

import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;

import java.security.GeneralSecurityException;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

public abstract class NoNullResponseTest extends AbstractBasicTest {
    private static final String GOOGLE_HTTPS_URL = "https://www.google.com";

    @Test(invocationCount = 4, groups = { "online", "default_provider" })
    public void multipleSslRequestsWithDelayAndKeepAlive() throws Exception {

        AsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setFollowRedirect(true).setSSLContext(getSSLContext()).setAllowPoolingConnections(true).setConnectTimeout(10000)
                .setPooledConnectionIdleTimeout(60000).setRequestTimeout(10000).setMaxConnectionsPerHost(-1).setMaxConnections(-1).build();

        try (AsyncHttpClient client = getAsyncHttpClient(config)) {
            final BoundRequestBuilder builder = client.prepareGet(GOOGLE_HTTPS_URL);
            final Response response1 = builder.execute().get();
            Thread.sleep(4000);
            final Response response2 = builder.execute().get();
            if (response2 != null) {
                System.out.println("Success (2nd response was not null).");
            } else {
                System.out.println("Failed (2nd response was null).");
            }
            assertNotNull(response1);
            assertNotNull(response2);
        }
    }

    private SSLContext getSSLContext() throws GeneralSecurityException {
        final SSLContext sslContext = SSLContext.getInstance("TLS");
        sslContext.init(null, new TrustManager[] { new MockTrustManager() }, null);
        return sslContext;
    }

    private static class MockTrustManager implements X509TrustManager {
        public X509Certificate[] getAcceptedIssuers() {
            return null;
        }

        public void checkClientTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
            // do nothing.
        }

        public void checkServerTrusted(final X509Certificate[] chain, final String authType) throws CertificateException {
            // Do nothing.
        }
    }
}


text:
require 'doodle'
require 'doodle/xml'

xml_source = %[<Address where="home"><City>London<Country>UK</Country></City></Address>]

class Base < Doodle
  include Doodle::XML
end
class Country < Base
  has :_text_
end
class City < Base
  has :_text_
  has Country, :default => "UK"
end
class Address < Base
  has :where, :default => "home"
  has City
end

a = Address :where => 'home' do
  city "London", :country => "England" do
    country "UK"
  end
end

a                               # =>
a.to_xml == xml_source          # =>
b = Doodle::XML.from_xml(Base, xml_source)
b                               # =>
b == a                          # =>
puts a.to_xml


text:
package org.xmlcml.ami.visitor.regex;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

/** contains the regexLists to use.
 *
 * @author pm286
 *
 */
public class RegexContainer {

	final static Logger LOG = Logger.getLogger(RegexContainer.class);

	private static final String SRC_MAIN_RESOURCES = "src/main/resources/";
	private static final String XHTML2STM_RESOURCES = SRC_MAIN_RESOURCES+"org/xmlcml/ami/";
	private static final String MAIN_REGEX_DIR_NAME = XHTML2STM_RESOURCES+"visitor/regex";
	private static final File MAIN_REGEX_DIR = new File(MAIN_REGEX_DIR_NAME);

	private Map<String, CompoundRegex> compoundRegexByTitleMap;
	private List<CompoundRegex> compoundRegexList;

	public RegexContainer() {
	}

	/** reads all dictionaries in directory.
	 *
	 * @param regexDir
	 */
	public void readCompoundRegexList(File regexDir) {
		File[] files = regexDir.listFiles();
		if (files != null) {
			readCompoundRegexes(files);
		}
		LOG.debug("read "+compoundRegexList+" regex files in; "+regexDir);
	}

	/** read given list of files.
	 *
	 * @param files
	 */
	public void readCompoundRegexes(File[] files) {
		ensureCompoundRegexByTitleMap();
		ensureCompoundRegexList();
		for (File file : files) {
			readCompoundRegexFile(file);
		}
		LOG.debug("raw compound Regex "+compoundRegexList.size()+" "+((compoundRegexList.size() > 0) ? compoundRegexList.get(0) : "null"));
		LOG.trace(compoundRegexByTitleMap);
	}

	void readCompoundRegexFile(File file) {
		CompoundRegex compoundRegex = CompoundRegex.readAndCreateRegex(file);
		addCompoundRegex(compoundRegex);
	}

	void readCompoundRegexURL(URL url) {
		CompoundRegex compoundRegex = CompoundRegex.readAndCreateRegex(url);
		addCompoundRegex(compoundRegex);
	}

	private void addCompoundRegex(CompoundRegex compoundRegex) {
		if (compoundRegex != null) {
			ensureCompoundRegexByTitleMap();
			String title = compoundRegex.getTitle();
			if (compoundRegexByTitleMap.get(title) != null) {
				LOG.debug("already read regexes for "+title);
			} else {
				compoundRegexList.add(compoundRegex);
				compoundRegexByTitleMap.put(title, compoundRegex);
				LOG.trace("read regexes for "+title);
			}
		}
	}

	void ensureCompoundRegexList() {
		if (compoundRegexList == null) {
			compoundRegexList = new ArrayList<CompoundRegex>();
		}
	}

	private void ensureCompoundRegexByTitleMap() {
		if (compoundRegexByTitleMap == null) {
			compoundRegexByTitleMap = new HashMap<String, CompoundRegex>();
			LOG.trace("created compoundRegexByTitleMap");
		}
		ensureCompoundRegexList();
	}

	public CompoundRegex getCompoundRegexByTitle(String title) {
		ensureCompoundRegexByTitleMap();
		return compoundRegexByTitleMap.get(title);
	}

	public List<CompoundRegex> getCompoundRegexList() {
		ensureCompoundRegexList();
		return compoundRegexList;
	}

}


text:
from neutron_lib import constants
from oslo_log import log as logging

from neutron.agent.l3 import namespaces
from neutron.agent.linux import ip_lib

LOG = logging.getLogger(__name__)
SNAT_NS_PREFIX = 'snat-'

class SnatNamespace(namespaces.Namespace):

    def __init__(self, router_id, agent_conf, driver, use_ipv6):
        self.router_id = router_id
        name = self.get_snat_ns_name(router_id)
        super(SnatNamespace, self).__init__(
            name, agent_conf, driver, use_ipv6)

    def create(self):
        super(SnatNamespace, self).create()
        # This might be an HA router namespaces and it should not have
        # ip_nonlocal_bind enabled
        ip_lib.set_ip_nonlocal_bind_for_namespace(self.name)
        # Set nf_conntrack_tcp_loose to 0 to ensure mid-stream
        # TCP conversations aren't taken over by SNAT
        cmd = ['net.netfilter.nf_conntrack_tcp_loose=0']
        ip_lib.sysctl(cmd, namespace=self.name)

    @classmethod
    def get_snat_ns_name(cls, router_id):
        return namespaces.build_ns_name(SNAT_NS_PREFIX, router_id)

    @namespaces.check_ns_existence
    def delete(self):
        ns_ip = ip_lib.IPWrapper(namespace=self.name)
        for d in ns_ip.get_devices():
            if d.name.startswith(constants.SNAT_INT_DEV_PREFIX):
                LOG.debug('Unplugging DVR device %s', d.name)
                self.driver.unplug(d.name, namespace=self.name,
                                   prefix=constants.SNAT_INT_DEV_PREFIX)
            elif d.name.startswith(namespaces.EXTERNAL_DEV_PREFIX):
                self.driver.unplug(
                    d.name,
                    bridge=self.agent_conf.external_network_bridge,
                    namespace=self.name,
                    prefix=namespaces.EXTERNAL_DEV_PREFIX)

        # TODO(mrsmith): delete ext-gw-port
        LOG.debug('DVR: destroy snat ns: %s', self.name)
        super(SnatNamespace, self).delete()


text:
<!doctype html>

<html>
  <head>
    <title>spark-selection</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="import" href="../packages/polymer/polymer.html">
    <link rel="import" href="example_ui.html">
  </head>
  <body>
    <example-ui></example-ui>
  </body>
</html>


text:
SYNONYM

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Docums Mycol. 8(no. 29): 37 (1978)

#### Original name
Leucoagaricus purpureorimosus Bon & Boiffard, 1978

### Remarks
null


text:
package com.perunlabs.tool.jvalgen.var.spec;

import static com.google.common.base.Functions.forMap;
import static com.google.common.base.Preconditions.checkState;
import static com.perunlabs.tool.jvalgen.Utils.list;
import static com.perunlabs.tool.jvalgen.java.type.JType.JBOOLEAN;
import static com.perunlabs.tool.jvalgen.java.type.JType.JFLOAT;
import static com.perunlabs.tool.jvalgen.java.type.JType.JINT;
import static com.perunlabs.tool.jvalgen.java.type.JType.JLONG;
import static com.perunlabs.tool.jvalgen.java.type.JType.jType;
import static com.perunlabs.tool.jvalgen.var.type.BasicVType.vType;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.AbstractXxxG;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.AbstractXxxS;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.AbstractXxxV;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.MostPrimitiveG;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.XxxC;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.XxxG;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.XxxS;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.XxxV;
import static com.perunlabs.tool.jvalgen.var.type.VTypeKind.XxxVImpl;

import com.google.common.base.Function;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.perunlabs.tool.jvalgen.Utils;
import com.perunlabs.tool.jvalgen.java.type.JType;
import com.perunlabs.tool.jvalgen.var.type.BasicVType;
import com.perunlabs.tool.jvalgen.var.type.ObjectiveVComponent;
import com.perunlabs.tool.jvalgen.var.type.VComponent;
import com.perunlabs.tool.jvalgen.var.type.VType;

public class AllVTypes {
  public static final String PACKAGE_ROOT = "com.perunlabs.common.jval";

  public static final JType V_API_CLASS = jType(PACKAGE_ROOT, "V", Utils.<JType> list());

  /*
   * TODO can this be fixed in more cleaner way?
   *
   * All VType instances have to be declared here so jTypeToVTypeF are created
   * correctly before operations (from XxxSpec classes) are instantiated.
   * Operation creation code uses these mapping and would not work correctly
   * when each VType is created in the same file as its operations.
   */

  /*
   * basic VTypes
   */
  public static final BasicVType VBOOL = vType(p("bool_"), "Bool", JBOOLEAN);
  public static final BasicVType VINT = vType(p("int_"), "Int", JINT);
  public static final BasicVType VLONG = vType(p("long_"), "Long", JLONG);
  public static final BasicVType VFLOAT = vType(p("float_"), "Float", JFLOAT);

  public static final ImmutableList<BasicVType> BASIC_VAR_TYPES = list(VBOOL, VINT, VLONG, VFLOAT);

  /*
   * VECTOR
   */

  public static final VVector VECTOR = new VVector();

  public static class VVector extends VType {
    public final VComponent x;
    public final VComponent y;

    public VVector() {
      this(new ObjectiveVComponent(VFLOAT, "x"), new ObjectiveVComponent(VFLOAT, "y"));
    }

    public VVector(VComponent x, VComponent y) {
      super(p("vector"), "Vector", list(x, y));

      this.x = x;
      this.y = y;
    }
  }

  /*
   * VECTOR3
   */

  public static final VVector3 VECTOR3 = new VVector3();

  public static class VVector3 extends VType {
    public final VComponent x;
    public final VComponent y;
    public final VComponent z;

    public VVector3() {
      this(new ObjectiveVComponent(VFLOAT, "x"), new ObjectiveVComponent(VFLOAT, "y"),
          new ObjectiveVComponent(VFLOAT, "z"));
    }

    public VVector3(VComponent x, VComponent y, VComponent z) {
      super(p("vector3"), "Vector3", list(x, y, z));

      this.x = x;
      this.y = y;
      this.z = z;
    }
  }

  /*
   * VECTOR4
   */

  public static final VMatrix4 MATRIX4 = new VMatrix4();

  public static class VMatrix4 extends VType {
    public final VComponent c11;
    public final VComponent c12;
    public final VComponent c13;
    public final VComponent c14;
    public final VComponent c21;
    public final VComponent c22;
    public final VComponent c23;
    public final VComponent c24;
    public final VComponent c31;
    public final VComponent c32;
    public final VComponent c33;
    public final VComponent c34;
    public final VComponent c41;
    public final VComponent c42;
    public final VComponent c43;
    public final VComponent c44;

    public VMatrix4() {
      this(new ObjectiveVComponent(VFLOAT, "c11"), new ObjectiveVComponent(VFLOAT, "c12"),
          new ObjectiveVComponent(VFLOAT, "c13"), new ObjectiveVComponent(VFLOAT, "c14"),

          new ObjectiveVComponent(VFLOAT, "c21"), new ObjectiveVComponent(VFLOAT, "c22"),
          new ObjectiveVComponent(VFLOAT, "c23"), new ObjectiveVComponent(VFLOAT, "c24"),

          new ObjectiveVComponent(VFLOAT, "c31"), new ObjectiveVComponent(VFLOAT, "c32"),
          new ObjectiveVComponent(VFLOAT, "c33"), new ObjectiveVComponent(VFLOAT, "c34"),

          new ObjectiveVComponent(VFLOAT, "c41"), new ObjectiveVComponent(VFLOAT, "c42"),
          new ObjectiveVComponent(VFLOAT, "c43"), new ObjectiveVComponent(VFLOAT, "c44"));
    }

    public VMatrix4(VComponent c11, VComponent c12, VComponent c13, VComponent c14, VComponent c21,
        VComponent c22, VComponent c23, VComponent c24, VComponent c31, VComponent c32,
        VComponent c33, VComponent c34, VComponent c41, VComponent c42, VComponent c43,
        VComponent c44) {
      super(p("matrix4"), "Matrix4", list(c11, c12, c13, c14, c21, c22, c23, c24, c31, c32, c33,
          c34, c41, c42, c43, c44));
      this.c11 = c11;
      this.c12 = c12;
      this.c13 = c13;
      this.c14 = c14;
      this.c21 = c21;
      this.c22 = c22;
      this.c23 = c23;
      this.c24 = c24;
      this.c31 = c31;
      this.c32 = c32;
      this.c33 = c33;
      this.c34 = c34;
      this.c41 = c41;
      this.c42 = c42;
      this.c43 = c43;
      this.c44 = c44;
    }
  }

  /*
   * FRAME
   */

  public static final VFrame FRAME = new VFrame();

  public static class VFrame extends VType {
    public final VComponent left;
    public final VComponent right;
    public final VComponent bottom;
    public final VComponent top;

    public VFrame() {
      this(new ObjectiveVComponent(VFLOAT, "left"), new ObjectiveVComponent(VFLOAT, "right"),
          new ObjectiveVComponent(VFLOAT, "bottom"), new ObjectiveVComponent(VFLOAT, "top"));
    }

    public VFrame(VComponent left, VComponent right, VComponent bottom, VComponent top) {
      super(p("frame"), "Frame", list(left, right, bottom, top));

      this.left = left;
      this.right = right;
      this.bottom = bottom;
      this.top = top;
    }
  }

  /*
   * FRAME3
   */

  public static final VFrame3 FRAME3 = new VFrame3();

  public static class VFrame3 extends VType {
    public final VComponent left;
    public final VComponent right;
    public final VComponent bottom;
    public final VComponent top;
    public final VComponent near;
    public final VComponent far;

    public VFrame3() {
      this(new ObjectiveVComponent(VFLOAT, "left"), new ObjectiveVComponent(VFLOAT, "right"),
          new ObjectiveVComponent(VFLOAT, "bottom"), new ObjectiveVComponent(VFLOAT, "top"),
          new ObjectiveVComponent(VFLOAT, "near"), new ObjectiveVComponent(VFLOAT, "far"));
    }

    public VFrame3(VComponent left, VComponent right, VComponent bottom, VComponent top,
        VComponent near, VComponent far) {
      super(p("frame3"), "Frame3", list(left, right, bottom, top, near, far));

      this.left = left;
      this.right = right;
      this.bottom = bottom;
      this.top = top;
      this.near = near;
      this.far = far;
    }
  }

  /*
   * QUANTITY
   */

  public static final VQuantity QUANTITY = new VQuantity();

  public static class VQuantity extends VType {
    public final VComponent vector;
    public final VComponent angle;

    public VQuantity() {
      this(new ObjectiveVComponent(VECTOR, "vector"), new ObjectiveVComponent(VFLOAT, "angle"));
    }

    public VQuantity(VComponent vector, VComponent angle) {
      super(p("quan"), "Quantity", list(vector, angle));

      this.vector = vector;
      this.angle = angle;
    }
  }

  /*
   * QUAD
   */

  public static final VQuad QUAD = new VQuad();

  public static class VQuad extends VType {
    public final VComponent v1;
    public final VComponent v2;
    public final VComponent v3;
    public final VComponent v4;

    public VQuad() {
      this(new ObjectiveVComponent(VECTOR, "v1"), new ObjectiveVComponent(VECTOR, "v2"),
          new ObjectiveVComponent(VECTOR, "v3"), new ObjectiveVComponent(VECTOR, "v4"));
    }

    public VQuad(VComponent v1, VComponent v2, VComponent v3, VComponent v4) {
      super(p("quad"), "Quad", list(v1, v2, v3, v4));

      this.v1 = v1;
      this.v2 = v2;
      this.v3 = v3;
      this.v4 = v4;
    }
  }

  public static final ImmutableList<VType> COMPOUND_VAR_TYPES = list(VECTOR, VECTOR3, MATRIX4,
      FRAME, FRAME3, QUANTITY, QUAD);

  public static final ImmutableList<VType> ALL_VAR_TYPES = ImmutableList.copyOf(Iterables.concat(
      BASIC_VAR_TYPES, COMPOUND_VAR_TYPES));

  /*
   * JType -> VType mapping
   */
  public static final Function<JType, VType> jTypeToVTypeF = createJTypeToVTypeMapping();

  private static Function<JType, VType> createJTypeToVTypeMapping() {
    ImmutableMap.Builder<JType, VType> map = ImmutableMap.builder();

    for (VType basicVType : BASIC_VAR_TYPES) {
      JType primitiveG = basicVType.jType(MostPrimitiveG);
      checkState(primitiveG.isPrimitive());
      map.put(primitiveG, basicVType);
    }

    for (VType vType : ALL_VAR_TYPES) {
      map.put(vType.jType(AbstractXxxG), vType);
      map.put(vType.jType(AbstractXxxS), vType);
      map.put(vType.jType(AbstractXxxV), vType);
      map.put(vType.jType(XxxC), vType);
      map.put(vType.jType(XxxG), vType);
      map.put(vType.jType(XxxS), vType);
      map.put(vType.jType(XxxV), vType);
      map.put(vType.jType(XxxVImpl), vType);
    }

    return forMap(map.build());
  }

  private static String p(String subPackage) {
    return PACKAGE_ROOT + "." + subPackage;
  }

  public static boolean isImplementingXxxG(JType type) {
    for (VType vType : ALL_VAR_TYPES) {
      if (type.isSubTypeOf(vType.jType(XxxG))) {
        return true;
      }
    }
    return false;
  }
}