Programming Language PHP
Namespace Oro\Component\PhpUtils
Class ClassGenerator
Method/Function addTrait
Total Examples 1
1 code examples of PHP Oro\Component\PhpUtils\ClassGenerator::addTrait extracted from open source projects
public function generate(array $schema, ClassGenerator $class): void
{
if (!$class->hasProperty(self::SERIALIZED_DATA_FIELD)) {
return;
}
if ($class->hasMethod('getSerializedData')) {
$class->getMethod('getSerializedData')->addComment('@internal');
$class->getMethod('setSerializedData')->addComment('@internal');
}
$class->addTrait(SerializedFieldsTrait::class);
if (!empty($schema['serialized_property']) && $this->isDebug) {
foreach (array_keys($schema['serialized_property']) as $fieldName) {
$class->addComment(sprintf('@property $%s', $fieldName));
}
}
}