<?php


namespace Entities;

use \Doctrine\Common\Collections\ArrayCollection;

/**
 * @Entity @HasLifecycleCallbacks
 * @Table(name="box")
 */
class Box 
{
	/**
	 * @Id
	 * @column(type="integer", nullable=false)
	 * @GeneratedValue(strategy="AUTO")
	 */
	protected $id;
	
	/** 
	 * @OneToMany(targetEntity="BoxItem", mappedBy="box")
	 */
	protected $items;
	
	public function __construct() {
		$this->items = new ArrayCollection();
	}
	
	public function toArray()
	{
		$data = array(); 
		$data['id'] 		 	= $this->getId();
		$data['itemsCount'] = $this->skambuciai->count();
		return $data;
	}

} 
