Improoved coding standards
This commit is contained in:
parent
d4059b88ca
commit
5f80b57554
@ -635,7 +635,7 @@ public function <methodName>()
|
|||||||
foreach ($metadata->associationMappings as $associationMapping) {
|
foreach ($metadata->associationMappings as $associationMapping) {
|
||||||
if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
|
if ($associationMapping['type'] & ClassMetadataInfo::TO_ONE) {
|
||||||
$nullable = $this->_isAssociationIsNullable($associationMapping);
|
$nullable = $this->_isAssociationIsNullable($associationMapping);
|
||||||
if ($code = $this->_generateEntityStubMethod($metadata, 'set', $associationMapping['fieldName'], $associationMapping['targetEntity'], ($nullable?'null':null))) {
|
if ($code = $this->_generateEntityStubMethod($metadata, 'set', $associationMapping['fieldName'], $associationMapping['targetEntity'], ($nullable ? 'null' : null))) {
|
||||||
$methods[] = $code;
|
$methods[] = $code;
|
||||||
}
|
}
|
||||||
if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], $associationMapping['targetEntity'])) {
|
if ($code = $this->_generateEntityStubMethod($metadata, 'get', $associationMapping['fieldName'], $associationMapping['targetEntity'])) {
|
||||||
@ -656,16 +656,14 @@ public function <methodName>()
|
|||||||
|
|
||||||
private function _isAssociationIsNullable($associationMapping)
|
private function _isAssociationIsNullable($associationMapping)
|
||||||
{
|
{
|
||||||
if(isset($associationMapping['joinColumns'])){
|
if (isset($associationMapping['joinColumns'])) {
|
||||||
$joinColumns = $associationMapping['joinColumns'];
|
$joinColumns = $associationMapping['joinColumns'];
|
||||||
}else{
|
} else {
|
||||||
//@todo thereis no way to retreive targetEntity metadata
|
//@todo thereis no way to retreive targetEntity metadata
|
||||||
//$targetMetadata = $this->getClassMetadata($associationMapping['targetEntity']);
|
|
||||||
//$joinColumns = $targetMetadata->associationMappings[$associationMapping["mappedBy"]]['joinColumns'];
|
|
||||||
$joinColumns = array();
|
$joinColumns = array();
|
||||||
}
|
}
|
||||||
foreach ($joinColumns as $joinColumn) {
|
foreach ($joinColumns as $joinColumn) {
|
||||||
if(isset($joinColumn['nullable']) && !$joinColumn['nullable']){
|
if(isset($joinColumn['nullable']) && !$joinColumn['nullable']) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -756,7 +754,7 @@ public function <methodName>()
|
|||||||
'<variableName>' => Inflector::camelize($fieldName),
|
'<variableName>' => Inflector::camelize($fieldName),
|
||||||
'<methodName>' => $methodName,
|
'<methodName>' => $methodName,
|
||||||
'<fieldName>' => $fieldName,
|
'<fieldName>' => $fieldName,
|
||||||
'<variableDefault>' => ($defaultValue!==null?('='.$defaultValue):''),
|
'<variableDefault>' => (($defaultValue !== null ) ? ('='.$defaultValue) : ''),
|
||||||
'<entity>' => $this->_getClassName($metadata)
|
'<entity>' => $this->_getClassName($metadata)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -825,10 +823,10 @@ public function <methodName>()
|
|||||||
{
|
{
|
||||||
$lines = array();
|
$lines = array();
|
||||||
$lines[] = $this->_spaces . '/**';
|
$lines[] = $this->_spaces . '/**';
|
||||||
|
|
||||||
if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) {
|
if ($associationMapping['type'] & ClassMetadataInfo::TO_MANY) {
|
||||||
$lines[] = $this->_spaces . ' * @var \Doctrine\Common\Collections\ArrayCollection';
|
$lines[] = $this->_spaces . ' * @var \Doctrine\Common\Collections\ArrayCollection';
|
||||||
}else{
|
} else {
|
||||||
$lines[] = $this->_spaces . ' * @var ' . $associationMapping['targetEntity'];
|
$lines[] = $this->_spaces . ' * @var ' . $associationMapping['targetEntity'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user