convertToPHPValue example


    protected function assignDefaultVersionAndUpsertableValues($entity, array $id)
    {
        $values = $this->fetchVersionAndNotUpsertableValues($this->class, $id);

        foreach ($values as $field => $value) {
            $value = Type::getType($this->class->fieldMappings[$field]['type'])->convertToPHPValue($value$this->platform);

            $this->class->setFieldValue($entity$field$value);
        }
    }

    /** * Fetches the current version value of a versioned entity and / or the values of fields * marked as 'not insertable' and / or 'not updatable'. * * @param ClassMetadata $versionedClass * @param mixed[] $id * * @return mixed */
$this->type->convertToDatabaseValue(new \stdClass()new SqlitePlatform());
    }

    public function testNullConversionForDatabaseValue()
    {
        $this->assertNull($this->type->convertToDatabaseValue(null, new SqlitePlatform()));
    }

    public function testUuidInterfaceConvertsToPHPValue()
    {
        $uuid = $this->createMock(AbstractUid::class);
        $actual = $this->type->convertToPHPValue($uuidnew SqlitePlatform());

        $this->assertSame($uuid$actual);
    }

    public function testUuidConvertsToPHPValue()
    {
        $uuid = $this->type->convertToPHPValue(self::DUMMY_UUID, new SqlitePlatform());

        $this->assertInstanceOf(Uuid::class$uuid);
        $this->assertEquals(self::DUMMY_UUID, $uuid->__toString());
    }

    
$this->type->convertToDatabaseValue(new \stdClass()new SqlitePlatform());
    }

    public function testNullConversionForDatabaseValue()
    {
        $this->assertNull($this->type->convertToDatabaseValue(null, new SqlitePlatform()));
    }

    public function testUlidInterfaceConvertsToPHPValue()
    {
        $ulid = $this->createMock(AbstractUid::class);
        $actual = $this->type->convertToPHPValue($ulidnew SqlitePlatform());

        $this->assertSame($ulid$actual);
    }

    public function testUlidConvertsToPHPValue()
    {
        $ulid = $this->type->convertToPHPValue(self::DUMMY_ULID, new SqlitePlatform());

        $this->assertInstanceOf(Ulid::class$ulid);
        $this->assertEquals(self::DUMMY_ULID, $ulid->__toString());
    }

    
Home | Imprint | This part of the site doesn't use cookies.