Last active
December 17, 2015 08:49
-
-
Save rufinus/5582603 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->add( | |
array( | |
'type' => 'DoctrineModule\Form\Element\ObjectSelect', | |
'name' => 'field_id', | |
'options' => array( | |
'object_manager' => $em, | |
'target_class' => 'Application\Entity\Field', | |
'label_generator' => function($targetEntity) { | |
return $targetEntity->getName(); | |
}, | |
'find_method' => array( | |
'name' => 'findCurrentMainpositionFields', | |
'params' => array('calendar_id' => $calendar->getCalendarId()) | |
), | |
), | |
'attributers' => array( | |
'id' => 'position', | |
'class'=> 'fake-select' | |
) | |
) | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Application\Entity; | |
use Doctrine\ORM\Mapping as ORM; | |
use Doctrine\Common\Collections\ArrayCollection; | |
/** | |
* Application\Entity\Field | |
* | |
* @ORM\Entity(repositoryClass="Application\Repository\FieldRepository") | |
* @ORM\Table(name="`field`", indexes={@ORM\Index(name="fk_field_tab1_idx", columns={"tab_id"}), @ORM\Index(name="fk_field_field1_idx", columns={"parent_id"}), @ORM\Index(name="fk_field_versionset1_idx", columns={"versionset_id"})}) | |
*/ | |
class Field | |
{ | |
/** | |
* @ORM\Id | |
* @ORM\Column(name="`field_id`", type="integer") | |
* @ORM\GeneratedValue(strategy="AUTO") | |
*/ | |
protected $field_id; | |
/** | |
* @ORM\Column(name="`name`", type="string", length=100) | |
*/ | |
protected $name; | |
/** | |
* @ORM\Column(name="`color`", type="string", length=6, nullable=true) | |
*/ | |
protected $color; | |
/** | |
* title, meta, calc | |
* | |
* @ORM\Column(name="`type`", type="string", length=20) | |
*/ | |
protected $type; | |
/** | |
* @ORM\Column(name="`pos`", type="integer") | |
*/ | |
protected $pos; | |
/** | |
* @ORM\Column(name="`weighting`", type="float", precision=4, scale=2, nullable=true) | |
*/ | |
protected $weighting; | |
/** | |
* step for slider | |
* | |
* @ORM\Column(name="`step`", type="integer", nullable=true) | |
*/ | |
protected $step; | |
/** | |
* @ORM\OneToMany(targetEntity="Event", mappedBy="field") | |
* @ORM\JoinColumn(name="field_id", referencedColumnName="field_id", nullable=false) | |
*/ | |
protected $events; | |
/** | |
* @ORM\OneToMany(targetEntity="Rating", mappedBy="field") | |
* @ORM\JoinColumn(name="field_id", referencedColumnName="field_id", nullable=false) | |
*/ | |
protected $ratings; | |
/** | |
* @ORM\ManyToOne(targetEntity="Tab", inversedBy="fields") | |
* @ORM\JoinColumn(name="tab_id", referencedColumnName="tab_id", nullable=false) | |
*/ | |
protected $tab; | |
/** | |
* @ORM\ManyToOne(targetEntity="Versionset", inversedBy="fields") | |
* @ORM\JoinColumn(name="versionset_id", referencedColumnName="versionset_id", nullable=false) | |
*/ | |
protected $versionset; | |
/** | |
* @ORM\ManyToOne(targetEntity="Field") | |
* @ORM\JoinColumn(name="parent_id", referencedColumnName="field_id") | |
*/ | |
protected $field; | |
public function __construct() | |
{ | |
$this->events = new ArrayCollection(); | |
$this->ratings = new ArrayCollection(); | |
} | |
/** | |
* Set the value of field_id. | |
* | |
* @param integer $field_id | |
* @return \Application\Entity\Field | |
*/ | |
public function setFieldId($field_id) | |
{ | |
$this->field_id = $field_id; | |
return $this; | |
} | |
/** | |
* Get the value of field_id. | |
* | |
* @return integer | |
*/ | |
public function getFieldId() | |
{ | |
return $this->field_id; | |
} | |
/** | |
* Set the value of name. | |
* | |
* @param string $name | |
* @return \Application\Entity\Field | |
*/ | |
public function setName($name) | |
{ | |
$this->name = $name; | |
return $this; | |
} | |
/** | |
* Get the value of name. | |
* | |
* @return string | |
*/ | |
public function getName() | |
{ | |
return $this->name; | |
} | |
/** | |
* Set the value of color. | |
* | |
* @param string $color | |
* @return \Application\Entity\Field | |
*/ | |
public function setColor($color) | |
{ | |
$this->color = $color; | |
return $this; | |
} | |
/** | |
* Get the value of color. | |
* | |
* @return string | |
*/ | |
public function getColor() | |
{ | |
return $this->color; | |
} | |
/** | |
* Set the value of type. | |
* | |
* @param string $type | |
* @return \Application\Entity\Field | |
*/ | |
public function setType($type) | |
{ | |
$this->type = $type; | |
return $this; | |
} | |
/** | |
* Get the value of type. | |
* | |
* @return string | |
*/ | |
public function getType() | |
{ | |
return $this->type; | |
} | |
/** | |
* Set the value of pos. | |
* | |
* @param integer $pos | |
* @return \Application\Entity\Field | |
*/ | |
public function setPos($pos) | |
{ | |
$this->pos = $pos; | |
return $this; | |
} | |
/** | |
* Get the value of pos. | |
* | |
* @return integer | |
*/ | |
public function getPos() | |
{ | |
return $this->pos; | |
} | |
/** | |
* Set the value of weighting. | |
* | |
* @param float $weighting | |
* @return \Application\Entity\Field | |
*/ | |
public function setWeighting($weighting) | |
{ | |
$this->weighting = $weighting; | |
return $this; | |
} | |
/** | |
* Get the value of weighting. | |
* | |
* @return float | |
*/ | |
public function getWeighting() | |
{ | |
return $this->weighting; | |
} | |
/** | |
* Set the value of step. | |
* | |
* @param integer $step | |
* @return \Application\Entity\Field | |
*/ | |
public function setStep($step) | |
{ | |
$this->step = $step; | |
return $this; | |
} | |
/** | |
* Get the value of step. | |
* | |
* @return integer | |
*/ | |
public function getStep() | |
{ | |
return $this->step; | |
} | |
/** | |
* Add Event entity to collection (one to many). | |
* | |
* @param \Application\Entity\Event $event | |
* @return \Application\Entity\Field | |
*/ | |
public function addEvent(Event $event) | |
{ | |
$this->events[] = $event; | |
return $this; | |
} | |
/** | |
* Get Event entity collection (one to many). | |
* | |
* @return \Doctrine\Common\Collections\Collection | |
*/ | |
public function getEvents() | |
{ | |
return $this->events; | |
} | |
/** | |
* Add Rating entity to collection (one to many). | |
* | |
* @param \Application\Entity\Rating $rating | |
* @return \Application\Entity\Field | |
*/ | |
public function addRating(Rating $rating) | |
{ | |
$this->ratings[] = $rating; | |
return $this; | |
} | |
/** | |
* Get Rating entity collection (one to many). | |
* | |
* @return \Doctrine\Common\Collections\Collection | |
*/ | |
public function getRatings() | |
{ | |
return $this->ratings; | |
} | |
/** | |
* Set Tab entity (many to one). | |
* | |
* @param \Application\Entity\Tab $tab | |
* @return \Application\Entity\Field | |
*/ | |
public function setTab(Tab $tab = null) | |
{ | |
$this->tab = $tab; | |
return $this; | |
} | |
/** | |
* Get Tab entity (many to one). | |
* | |
* @return \Application\Entity\Tab | |
*/ | |
public function getTab() | |
{ | |
return $this->tab; | |
} | |
/** | |
* Set Versionset entity (many to one). | |
* | |
* @param \Application\Entity\Versionset $versionset | |
* @return \Application\Entity\Field | |
*/ | |
public function setVersionset(Versionset $versionset = null) | |
{ | |
$this->versionset = $versionset; | |
return $this; | |
} | |
/** | |
* Get Versionset entity (many to one). | |
* | |
* @return \Application\Entity\Versionset | |
*/ | |
public function getVersionset() | |
{ | |
return $this->versionset; | |
} | |
/** | |
* Set Field entity (many to one). | |
* | |
* @param \Application\Entity\Field $field | |
* @return \Application\Entity\Field | |
*/ | |
public function setField(Field $field = null) | |
{ | |
$this->field = $field; | |
return $this; | |
} | |
/** | |
* Get Field entity (many to one). | |
* | |
* @return \Application\Entity\Field | |
*/ | |
public function getField() | |
{ | |
return $this->field; | |
} | |
public function __sleep() | |
{ | |
return array('field_id', 'tab_id', 'versionset_id', 'name', 'color', 'type', 'parent_id', 'pos', 'weighting', 'step'); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'INSERT INTO `event` (`name`, `shortname`, `date_start`, `date_end`, `state`, `department`, `responsible`, `comment`, `evaluated`, calendar_id, versionset_id, field_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)' with params ["SuperDuper", "super", "2013-05-01", "2013-05-15", "2", "department", "responsible", "comment", 0, 1, "8", null]: | |
SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'field_id' cannot be null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array | |
( | |
[event] => Array | |
( | |
[event_id] => | |
[calendar_id] => | |
[name] => SuperDuper | |
[shortname] => super | |
[date_start_display] => 01.05.2013 | |
[date_start] => 2013-05-01 | |
[date_end_display] => 15.05.2013 | |
[date_end] => 2013-05-15 | |
[milestones] => Array | |
( | |
[0] => Array | |
( | |
[event_id] => | |
[milestone_id] => | |
[milestones_display_from] => | |
[date_start] => | |
[milestones_display_to] => | |
[date_end] => | |
) | |
) | |
[field_id] => 49 | |
[state] => 2 | |
[department] => | |
[responsible] => | |
[comment] => | |
) | |
[calendar] => 1 | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment