2008-05-06 17:41:22 +04:00
|
|
|
<?php
|
2008-02-11 20:08:22 +03:00
|
|
|
/*
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
* This software consists of voluntary contributions made by many individuals
|
|
|
|
* and is licensed under the LGPL. For more information, see
|
2009-02-07 20:02:13 +03:00
|
|
|
* <http://www.doctrine-project.org>.
|
2008-02-11 20:08:22 +03:00
|
|
|
*/
|
2008-02-04 00:29:57 +03:00
|
|
|
|
2009-01-22 22:38:10 +03:00
|
|
|
namespace Doctrine\ORM\Mapping;
|
2008-05-30 16:09:24 +04:00
|
|
|
|
2009-02-04 19:35:36 +03:00
|
|
|
use Doctrine\Common\DoctrineException;
|
2008-07-21 00:13:24 +04:00
|
|
|
|
2008-02-04 00:29:57 +03:00
|
|
|
/**
|
2009-07-30 19:16:02 +04:00
|
|
|
* A <tt>ClassMetadata</tt> instance holds all the object-relational mapping metadata
|
|
|
|
* of an entity and it's associations.
|
2009-07-25 20:52:19 +04:00
|
|
|
*
|
|
|
|
* Once populated, ClassMetadata instances are usually cached in a serialized form.
|
2008-02-04 00:29:57 +03:00
|
|
|
*
|
2009-05-14 14:03:09 +04:00
|
|
|
* <b>IMPORTANT NOTE:</b>
|
|
|
|
*
|
|
|
|
* The fields of this class are only public for 2 reasons:
|
|
|
|
* 1) To allow fast READ access.
|
|
|
|
* 2) To drastically reduce the size of a serialized instance (private/protected members
|
|
|
|
* get the whole class name, namespace inclusive, prepended to every property in
|
|
|
|
* the serialized representation).
|
|
|
|
*
|
2008-02-24 23:31:49 +03:00
|
|
|
* @author Roman Borschel <roman@code-factory.org>
|
2009-10-05 09:42:30 +04:00
|
|
|
* @author Jonathan H. Wage <jonwage@gmail.com>
|
2008-03-26 14:10:45 +03:00
|
|
|
* @since 2.0
|
2008-02-04 00:29:57 +03:00
|
|
|
*/
|
2009-12-21 14:06:27 +03:00
|
|
|
class ClassMetadata extends ClassMetadataInfo
|
2008-05-06 17:41:22 +04:00
|
|
|
{
|
2009-01-05 23:18:56 +03:00
|
|
|
/**
|
|
|
|
* The ReflectionClass instance of the mapped class.
|
|
|
|
*
|
|
|
|
* @var ReflectionClass
|
|
|
|
*/
|
2009-05-14 14:03:09 +04:00
|
|
|
public $reflClass;
|
2009-01-05 23:18:56 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The ReflectionProperty instances of the mapped class.
|
|
|
|
*
|
|
|
|
* @var array
|
|
|
|
*/
|
2009-09-29 19:54:16 +04:00
|
|
|
public $reflFields = array();
|
2009-02-17 13:54:18 +03:00
|
|
|
|
2008-02-04 00:29:57 +03:00
|
|
|
/**
|
2009-02-04 19:35:36 +03:00
|
|
|
* Initializes a new ClassMetadata instance that will hold the object-relational mapping
|
|
|
|
* metadata of the class with the given name.
|
2008-02-04 00:29:57 +03:00
|
|
|
*
|
2009-07-18 15:41:37 +04:00
|
|
|
* @param string $entityName The name of the entity class the new instance is used for.
|
2008-02-04 00:29:57 +03:00
|
|
|
*/
|
2008-12-18 17:08:11 +03:00
|
|
|
public function __construct($entityName)
|
2008-05-06 17:41:22 +04:00
|
|
|
{
|
2009-05-14 14:03:09 +04:00
|
|
|
$this->name = $entityName;
|
2009-07-24 15:33:38 +04:00
|
|
|
$this->reflClass = new \ReflectionClass($entityName);
|
2009-07-28 20:36:24 +04:00
|
|
|
$this->namespace = $this->reflClass->getNamespaceName();
|
|
|
|
$this->primaryTable['name'] = $this->reflClass->getShortName();
|
|
|
|
$this->rootEntityName = $entityName;
|
2009-11-03 21:30:21 +03:00
|
|
|
|
|
|
|
//$this->prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
|
2008-02-04 00:29:57 +03:00
|
|
|
}
|
2008-12-18 17:08:11 +03:00
|
|
|
|
2009-01-03 22:50:13 +03:00
|
|
|
/**
|
|
|
|
* Gets the ReflectionClass instance of the mapped class.
|
|
|
|
*
|
|
|
|
* @return ReflectionClass
|
|
|
|
*/
|
2008-12-18 17:08:11 +03:00
|
|
|
public function getReflectionClass()
|
|
|
|
{
|
2009-05-14 14:03:09 +04:00
|
|
|
return $this->reflClass;
|
2008-12-18 17:08:11 +03:00
|
|
|
}
|
|
|
|
|
2009-01-03 22:50:13 +03:00
|
|
|
/**
|
|
|
|
* Gets the ReflectionPropertys of the mapped class.
|
|
|
|
*
|
|
|
|
* @return array An array of ReflectionProperty instances.
|
|
|
|
*/
|
2008-12-18 17:08:11 +03:00
|
|
|
public function getReflectionProperties()
|
|
|
|
{
|
2009-05-14 14:03:09 +04:00
|
|
|
return $this->reflFields;
|
2008-12-18 17:08:11 +03:00
|
|
|
}
|
|
|
|
|
2009-04-09 22:12:48 +04:00
|
|
|
/**
|
|
|
|
* INTERNAL:
|
|
|
|
* Adds a reflection property. Usually only used by the ClassMetadataFactory
|
|
|
|
* while processing inheritance mappings.
|
|
|
|
*
|
|
|
|
* @param array $props
|
|
|
|
*/
|
|
|
|
public function addReflectionProperty($propName, \ReflectionProperty $property)
|
|
|
|
{
|
2009-05-14 14:03:09 +04:00
|
|
|
$this->reflFields[$propName] = $property;
|
2009-04-09 22:12:48 +04:00
|
|
|
}
|
|
|
|
|
2009-01-03 22:50:13 +03:00
|
|
|
/**
|
|
|
|
* Gets a ReflectionProperty for a specific field of the mapped class.
|
|
|
|
*
|
|
|
|
* @param string $name
|
|
|
|
* @return ReflectionProperty
|
|
|
|
*/
|
2008-12-18 17:08:11 +03:00
|
|
|
public function getReflectionProperty($name)
|
2008-05-17 16:22:24 +04:00
|
|
|
{
|
2009-05-14 14:03:09 +04:00
|
|
|
return $this->reflFields[$name];
|
2008-05-17 16:22:24 +04:00
|
|
|
}
|
2008-05-06 17:41:22 +04:00
|
|
|
|
2009-01-05 20:25:56 +03:00
|
|
|
/**
|
2009-02-07 20:02:13 +03:00
|
|
|
* Gets the ReflectionProperty for the single identifier field.
|
2009-01-05 20:25:56 +03:00
|
|
|
*
|
2009-02-07 20:02:13 +03:00
|
|
|
* @return ReflectionProperty
|
2009-11-21 21:52:02 +03:00
|
|
|
* @throws BadMethodCallException If the class has a composite identifier.
|
2009-01-05 20:25:56 +03:00
|
|
|
*/
|
2009-01-03 22:50:13 +03:00
|
|
|
public function getSingleIdReflectionProperty()
|
|
|
|
{
|
2009-05-14 14:03:09 +04:00
|
|
|
if ($this->isIdentifierComposite) {
|
2009-11-21 21:52:02 +03:00
|
|
|
throw new \BadMethodCallException("Class " . $this->name . " has a composite identifier.");
|
2009-01-03 22:50:13 +03:00
|
|
|
}
|
2009-05-14 14:03:09 +04:00
|
|
|
return $this->reflFields[$this->identifier[0]];
|
2009-01-03 22:50:13 +03:00
|
|
|
}
|
2009-10-05 08:11:29 +04:00
|
|
|
|
2008-02-04 00:29:57 +03:00
|
|
|
/**
|
2009-10-05 08:11:29 +04:00
|
|
|
* Validates & completes the given field mapping.
|
2008-02-04 00:29:57 +03:00
|
|
|
*
|
2009-10-05 08:11:29 +04:00
|
|
|
* @param array $mapping The field mapping to validated & complete.
|
|
|
|
* @return array The validated and completed field mapping.
|
2008-02-04 00:29:57 +03:00
|
|
|
*/
|
2009-10-05 08:11:29 +04:00
|
|
|
protected function _validateAndCompleteFieldMapping(array &$mapping)
|
2008-02-04 00:29:57 +03:00
|
|
|
{
|
2009-10-05 08:11:29 +04:00
|
|
|
parent::_validateAndCompleteFieldMapping($mapping);
|
|
|
|
|
|
|
|
// Store ReflectionProperty of mapped field
|
|
|
|
$refProp = $this->reflClass->getProperty($mapping['fieldName']);
|
|
|
|
$refProp->setAccessible(true);
|
|
|
|
$this->reflFields[$mapping['fieldName']] = $refProp;
|
2008-02-04 00:29:57 +03:00
|
|
|
}
|
2008-05-06 17:41:22 +04:00
|
|
|
|
2009-04-09 22:12:48 +04:00
|
|
|
/**
|
2009-10-05 08:11:29 +04:00
|
|
|
* Extracts the identifier values of an entity of this class.
|
|
|
|
*
|
|
|
|
* For composite identifiers, the identifier values are returned as an array
|
|
|
|
* with the same order as the field order in {@link identifier}.
|
2009-04-09 22:12:48 +04:00
|
|
|
*
|
2009-10-05 08:11:29 +04:00
|
|
|
* @param object $entity
|
|
|
|
* @return mixed
|
2009-04-09 22:12:48 +04:00
|
|
|
*/
|
2009-10-05 08:11:29 +04:00
|
|
|
public function getIdentifierValues($entity)
|
2009-04-09 22:12:48 +04:00
|
|
|
{
|
2009-10-05 08:11:29 +04:00
|
|
|
if ($this->isIdentifierComposite) {
|
|
|
|
$id = array();
|
|
|
|
foreach ($this->identifier as $idField) {
|
|
|
|
$value = $this->reflFields[$idField]->getValue($entity);
|
|
|
|
if ($value !== null) {
|
2009-11-21 21:52:02 +03:00
|
|
|
$id[$idField] = $value;
|
2009-10-05 08:11:29 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return $id;
|
2009-04-09 22:12:48 +04:00
|
|
|
} else {
|
2009-11-21 21:52:02 +03:00
|
|
|
return array($this->identifier[0] => $this->reflFields[$this->identifier[0]]->getValue($entity));
|
2009-04-09 22:12:48 +04:00
|
|
|
}
|
|
|
|
}
|
2009-10-28 13:31:47 +03:00
|
|
|
|
|
|
|
public function getColumnValues($entity, array $columns)
|
|
|
|
{
|
|
|
|
$values = array();
|
|
|
|
foreach ($columns as $column) {
|
|
|
|
$values[] = $this->reflFields[$this->fieldNames[$column]]->getValue($entity);
|
|
|
|
}
|
|
|
|
return $values;
|
|
|
|
}
|
2009-04-09 22:12:48 +04:00
|
|
|
|
2008-03-17 16:26:34 +03:00
|
|
|
/**
|
2009-10-05 08:11:29 +04:00
|
|
|
* Populates the entity identifier of an entity.
|
2008-03-17 16:26:34 +03:00
|
|
|
*
|
2009-10-05 08:11:29 +04:00
|
|
|
* @param object $entity
|
|
|
|
* @param mixed $id
|
|
|
|
* @todo Rename to assignIdentifier()
|
2008-03-17 16:26:34 +03:00
|
|
|
*/
|
2009-10-05 08:11:29 +04:00
|
|
|
public function setIdentifierValues($entity, $id)
|
2008-02-28 18:30:55 +03:00
|
|
|
{
|
2009-10-05 08:11:29 +04:00
|
|
|
if ($this->isIdentifierComposite) {
|
|
|
|
foreach ((array)$id as $idField => $idValue) {
|
|
|
|
$this->reflFields[$idField]->setValue($entity, $idValue);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$this->reflFields[$this->identifier[0]]->setValue($entity, $id);
|
|
|
|
}
|
2008-02-28 18:30:55 +03:00
|
|
|
}
|
2008-05-06 17:41:22 +04:00
|
|
|
|
2008-02-04 00:29:57 +03:00
|
|
|
/**
|
2009-10-05 08:11:29 +04:00
|
|
|
* Sets the specified field to the specified value on the given entity.
|
2008-02-04 00:29:57 +03:00
|
|
|
*
|
2009-10-05 08:11:29 +04:00
|
|
|
* @param object $entity
|
|
|
|
* @param string $field
|
|
|
|
* @param mixed $value
|
2008-02-04 00:29:57 +03:00
|
|
|
*/
|
2009-10-05 08:11:29 +04:00
|
|
|
public function setFieldValue($entity, $field, $value)
|
2008-02-04 00:29:57 +03:00
|
|
|
{
|
2009-10-05 08:11:29 +04:00
|
|
|
$this->reflFields[$field]->setValue($entity, $value);
|
2008-08-31 22:27:16 +04:00
|
|
|
}
|
2008-12-18 17:08:11 +03:00
|
|
|
|
|
|
|
/**
|
2009-10-05 08:11:29 +04:00
|
|
|
* Sets the field mapped to the specified column to the specified value on the given entity.
|
2008-12-18 17:08:11 +03:00
|
|
|
*
|
2009-10-05 08:11:29 +04:00
|
|
|
* @param object $entity
|
|
|
|
* @param string $field
|
|
|
|
* @param mixed $value
|
2008-02-04 00:29:57 +03:00
|
|
|
*/
|
2009-10-05 08:11:29 +04:00
|
|
|
public function setColumnValue($entity, $column, $value)
|
2008-02-04 00:29:57 +03:00
|
|
|
{
|
2009-10-05 08:11:29 +04:00
|
|
|
$this->reflFields[$this->fieldNames[$column]]->setValue($entity, $value);
|
2008-02-04 00:29:57 +03:00
|
|
|
}
|
2008-05-06 17:41:22 +04:00
|
|
|
|
2008-08-31 22:27:16 +04:00
|
|
|
/**
|
|
|
|
* Stores the association mapping.
|
|
|
|
*
|
2009-02-04 19:35:36 +03:00
|
|
|
* @param AssociationMapping $assocMapping
|
2008-08-31 22:27:16 +04:00
|
|
|
*/
|
2009-10-05 08:11:29 +04:00
|
|
|
protected function _storeAssociationMapping(AssociationMapping $assocMapping)
|
2008-08-31 22:27:16 +04:00
|
|
|
{
|
2009-10-05 08:11:29 +04:00
|
|
|
parent::_storeAssociationMapping($assocMapping);
|
2009-01-12 16:34:41 +03:00
|
|
|
|
|
|
|
// Store ReflectionProperty of mapped field
|
2009-10-05 08:11:29 +04:00
|
|
|
$sourceFieldName = $assocMapping->sourceFieldName;
|
2009-05-14 14:03:09 +04:00
|
|
|
$refProp = $this->reflClass->getProperty($sourceFieldName);
|
2009-01-12 16:34:41 +03:00
|
|
|
$refProp->setAccessible(true);
|
2009-05-14 14:03:09 +04:00
|
|
|
$this->reflFields[$sourceFieldName] = $refProp;
|
2008-02-04 00:29:57 +03:00
|
|
|
}
|
2008-02-13 13:53:07 +03:00
|
|
|
|
2008-07-10 21:17:58 +04:00
|
|
|
/**
|
2009-02-04 19:35:36 +03:00
|
|
|
* Dispatches the lifecycle event of the given entity to the registered
|
2008-07-10 21:17:58 +04:00
|
|
|
* lifecycle callbacks and lifecycle listeners.
|
|
|
|
*
|
|
|
|
* @param string $event The lifecycle event.
|
|
|
|
* @param Entity $entity The Entity on which the event occured.
|
|
|
|
*/
|
2009-01-22 22:38:10 +03:00
|
|
|
public function invokeLifecycleCallbacks($lifecycleEvent, $entity)
|
2008-07-10 21:17:58 +04:00
|
|
|
{
|
2009-07-18 15:41:37 +04:00
|
|
|
foreach ($this->lifecycleCallbacks[$lifecycleEvent] as $callback) {
|
2008-07-10 21:17:58 +04:00
|
|
|
$entity->$callback();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-11 14:51:38 +04:00
|
|
|
/**
|
|
|
|
* Gets the (possibly quoted) column name of a mapped field for safe use
|
|
|
|
* in an SQL statement.
|
|
|
|
*
|
|
|
|
* @param string $field
|
|
|
|
* @param AbstractPlatform $platform
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getQuotedColumnName($field, $platform)
|
|
|
|
{
|
|
|
|
return isset($this->fieldMappings[$field]['quoted']) ?
|
|
|
|
$platform->quoteIdentifier($this->fieldMappings[$field]['columnName']) :
|
|
|
|
$this->fieldMappings[$field]['columnName'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the (possibly quoted) primary table name of this class for safe use
|
|
|
|
* in an SQL statement.
|
|
|
|
*
|
|
|
|
* @param AbstractPlatform $platform
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getQuotedTableName($platform)
|
|
|
|
{
|
|
|
|
return isset($this->primaryTable['quoted']) ?
|
|
|
|
$platform->quoteIdentifier($this->primaryTable['name']) :
|
|
|
|
$this->primaryTable['name'];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Gets the (possibly quoted) name of the discriminator column for safe use
|
|
|
|
* in an SQL statement.
|
|
|
|
*
|
|
|
|
* @param AbstractPlatform $platform
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function getQuotedDiscriminatorColumnName($platform)
|
|
|
|
{
|
|
|
|
return isset($this->discriminatorColumn['quoted']) ?
|
|
|
|
$platform->quoteIdentifier($this->discriminatorColumn['name']) :
|
|
|
|
$this->discriminatorColumn['name'];
|
|
|
|
}
|
|
|
|
|
2009-03-30 23:43:05 +04:00
|
|
|
/**
|
|
|
|
* Creates a string representation of this instance.
|
|
|
|
*
|
|
|
|
* @return string The string representation of this instance.
|
2009-06-07 21:20:37 +04:00
|
|
|
* @todo Construct meaningful string representation.
|
2009-03-30 23:43:05 +04:00
|
|
|
*/
|
2008-02-04 00:29:57 +03:00
|
|
|
public function __toString()
|
|
|
|
{
|
2009-01-03 22:50:13 +03:00
|
|
|
return __CLASS__ . '@' . spl_object_hash($this);
|
2008-02-04 00:29:57 +03:00
|
|
|
}
|
2009-08-11 14:51:38 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Determines which fields get serialized.
|
|
|
|
*
|
|
|
|
* Parts that are NOT serialized because they can not be properly unserialized:
|
|
|
|
* - reflClass (ReflectionClass)
|
|
|
|
* - reflFields (ReflectionProperty array)
|
|
|
|
*
|
|
|
|
* @return array The names of all the fields that should be serialized.
|
|
|
|
*/
|
|
|
|
public function __sleep()
|
|
|
|
{
|
|
|
|
return array(
|
2009-12-21 14:06:27 +03:00
|
|
|
'associationMappings', // unserialization bottleneck with many assocs
|
2009-08-11 14:51:38 +04:00
|
|
|
'changeTrackingPolicy',
|
2009-12-21 14:06:27 +03:00
|
|
|
'columnNames', //TODO: Not really needed. Can use fieldMappings[$fieldName]['columnName']
|
2009-08-11 14:51:38 +04:00
|
|
|
'customRepositoryClassName',
|
|
|
|
'discriminatorColumn',
|
|
|
|
'discriminatorValue',
|
2009-10-04 02:00:01 +04:00
|
|
|
'discriminatorMap',
|
2009-08-11 14:51:38 +04:00
|
|
|
'fieldMappings',
|
2009-12-21 14:06:27 +03:00
|
|
|
'fieldNames', //TODO: Not all of this stuff needs to be serialized. Only type, columnName and fieldName.
|
2009-08-11 14:51:38 +04:00
|
|
|
'generatorType',
|
|
|
|
'identifier',
|
2009-12-21 14:06:27 +03:00
|
|
|
'idGenerator', //TODO: Does not really need to be serialized. Could be moved to runtime.
|
2009-08-11 14:51:38 +04:00
|
|
|
'inheritanceType',
|
|
|
|
'inheritedAssociationFields',
|
2009-12-09 15:37:57 +03:00
|
|
|
'inverseMappings', //TODO: Remove!
|
2009-08-11 14:51:38 +04:00
|
|
|
'isIdentifierComposite',
|
|
|
|
'isMappedSuperclass',
|
|
|
|
'isVersioned',
|
|
|
|
'lifecycleCallbacks',
|
|
|
|
'name',
|
2009-12-21 14:06:27 +03:00
|
|
|
//'namespace',
|
2009-08-11 14:51:38 +04:00
|
|
|
'parentClasses',
|
|
|
|
'primaryTable',
|
|
|
|
'rootEntityName',
|
2009-12-21 14:06:27 +03:00
|
|
|
//'sequenceGeneratorDefinition',
|
2009-08-11 14:51:38 +04:00
|
|
|
'subClasses',
|
|
|
|
'versionField'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2009-10-24 01:47:25 +04:00
|
|
|
* Restores some state that can not be serialized/unserialized.
|
2009-08-11 14:51:38 +04:00
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function __wakeup()
|
|
|
|
{
|
|
|
|
// Restore ReflectionClass and properties
|
|
|
|
$this->reflClass = new \ReflectionClass($this->name);
|
2010-01-15 16:33:42 +03:00
|
|
|
foreach ($this->fieldMappings as $field => $mapping) {
|
|
|
|
if (isset($mapping['inherited'])) {
|
|
|
|
$reflField = new \ReflectionProperty($mapping['inherited'], $field);
|
|
|
|
} else {
|
|
|
|
$reflField = $this->reflClass->getProperty($field);
|
|
|
|
}
|
|
|
|
$reflField->setAccessible(true);
|
|
|
|
$this->reflFields[$field] = $reflField;
|
2009-08-11 14:51:38 +04:00
|
|
|
}
|
|
|
|
foreach ($this->associationMappings as $field => $mapping) {
|
2010-01-15 16:33:42 +03:00
|
|
|
if (isset($this->inheritedAssociationFields[$field])) {
|
|
|
|
$reflField = new \ReflectionProperty($this->inheritedAssociationFields[$field], $field);
|
|
|
|
} else {
|
|
|
|
$reflField = $this->reflClass->getProperty($field);
|
|
|
|
}
|
|
|
|
$reflField->setAccessible(true);
|
|
|
|
$this->reflFields[$field] = $reflField;
|
2009-08-11 14:51:38 +04:00
|
|
|
}
|
2009-11-03 21:30:21 +03:00
|
|
|
|
|
|
|
//$this->prototype = unserialize(sprintf('O:%d:"%s":0:{}', strlen($this->name), $this->name));
|
2009-08-11 14:51:38 +04:00
|
|
|
}
|
2009-11-03 21:30:21 +03:00
|
|
|
|
|
|
|
//public $prototype;
|
2009-07-20 16:05:19 +04:00
|
|
|
}
|