123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?php
- /*
- * 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 MIT license. For more information, see
- * <http://www.doctrine-project.org>.
- */
- namespace Doctrine\Tests\Common\Proxy;
- use ReflectionClass;
- use Doctrine\Common\Persistence\Mapping\ClassMetadata;
- /**
- * Class metadata test asset for @see LazyLoadableObject
- *
- * @author Marco Pivetta <ocramius@gmail.com>
- * @since 2.4
- */
- class LazyLoadableObjectClassMetadata implements ClassMetadata
- {
- /**
- * @var ReflectionClass
- */
- protected $reflectionClass;
- /**
- * @var array
- */
- protected $identifier = array(
- 'publicIdentifierField' => true,
- 'protectedIdentifierField' => true,
- );
- /**
- * @var array
- */
- protected $fields = array(
- 'publicIdentifierField' => true,
- 'protectedIdentifierField' => true,
- 'publicPersistentField' => true,
- 'protectedPersistentField' => true,
- );
- /**
- * @var array
- */
- protected $associations = array(
- 'publicAssociation' => true,
- 'protectedAssociation' => true,
- );
- /**
- * {@inheritDoc}
- */
- public function getName()
- {
- return $this->getReflectionClass()->getName();
- }
- /**
- * {@inheritDoc}
- */
- public function getIdentifier()
- {
- return array_keys($this->identifier);
- }
- /**
- * {@inheritDoc}
- */
- public function getReflectionClass()
- {
- if (null === $this->reflectionClass) {
- $this->reflectionClass = new \ReflectionClass(__NAMESPACE__ . '\LazyLoadableObject');
- }
- return $this->reflectionClass;
- }
- /**
- * {@inheritDoc}
- */
- public function isIdentifier($fieldName)
- {
- return isset($this->identifier[$fieldName]);
- }
- /**
- * {@inheritDoc}
- */
- public function hasField($fieldName)
- {
- return isset($this->fields[$fieldName]);
- }
- /**
- * {@inheritDoc}
- */
- public function hasAssociation($fieldName)
- {
- return isset($this->associations[$fieldName]);
- }
- /**
- * {@inheritDoc}
- */
- public function isSingleValuedAssociation($fieldName)
- {
- throw new \BadMethodCallException('not implemented');
- }
- /**
- * {@inheritDoc}
- */
- public function isCollectionValuedAssociation($fieldName)
- {
- throw new \BadMethodCallException('not implemented');
- }
- /**
- * {@inheritDoc}
- */
- public function getFieldNames()
- {
- return array_keys($this->fields);
- }
- /**
- * {@inheritDoc}
- */
- public function getIdentifierFieldNames()
- {
- return $this->getIdentifier();
- }
- /**
- * {@inheritDoc}
- */
- public function getAssociationNames()
- {
- return array_keys($this->associations);
- }
- /**
- * {@inheritDoc}
- */
- public function getTypeOfField($fieldName)
- {
- return 'string';
- }
- /**
- * {@inheritDoc}
- */
- public function getAssociationTargetClass($assocName)
- {
- throw new \BadMethodCallException('not implemented');
- }
- /**
- * {@inheritDoc}
- */
- public function isAssociationInverseSide($assocName)
- {
- throw new \BadMethodCallException('not implemented');
- }
- /**
- * {@inheritDoc}
- */
- public function getAssociationMappedByTargetField($assocName)
- {
- throw new \BadMethodCallException('not implemented');
- }
- /**
- * {@inheritDoc}
- */
- public function getIdentifierValues($object)
- {
- throw new \BadMethodCallException('not implemented');
- }
- }
|