protected function setupDefaultMachine(array $config)
	{
		// Name of inputs and outputs with properties
		$io_name = isset($config['io_name']) ? (string) $config['io_name'] : 'item';

		// Create default transitions?
		$no_default_transitions = !empty($config['crud_machine_no_default_transitions']);	/// @deprecated

		// Exists state only
		$this->states = array_replace_recursive($no_default_transitions ? array() : array(
			'exists' => array(
				'label' => _('Exists'),
				'description' => '',
			),
		), $this->states ? : []);

		// Simple 'exists' state if not state select is not defined
		if ($this->state_select === null) {
			$this->state_select = '"exists"';
		}

		// Actions
		$this->actions = array_replace_recursive(array(
			'create' => array(
				'label' => _('Create'),
				'description' => _('Create a new item'),
				'transitions' => $no_default_transitions ? array() : array(
					'' => array(
						'targets' => array('exists'),
					),
				),
				'returns' => self::RETURNS_NEW_ID,
				'block' => array(
					'inputs' => array(
						$io_name => array()
					),
					'outputs' => array(
						'ref' => 'return_value'
					),
					'accepted_exceptions' => array(
						'PDOException' => true,
					),
				),
			),
			'edit' => array(
				'label' => _('Edit'),
				'description' => _('Modify item'),
				'transitions' => $no_default_transitions ? array() : array(
					'exists' => array(
						'targets' => array('exists'),
					),
				),
				'block' => array(
					'inputs' => array(
						'ref' => array(),
						$io_name => array()
					),
					'outputs' => array(
						'ref' => 'ref'
					),
					'accepted_exceptions' => array(
						'PDOException' => true,
					),
				),
			),
			'delete' => array(
				'label' => _('Delete'),
				'description' => _('Delete item'),
				'weight' => 80,
				'transitions' => $no_default_transitions ? array() : array(
					'exists' => array(
						'targets' => array(''),
					),
				),
				'block' => array(
					'inputs' => array(
						'ref' => array(),
					),
					'outputs' => array(
					),
					'accepted_exceptions' => array(
						'PDOException' => true,
					),
				),
			),
		), $this->actions ? : []);
	}
protected function setupDefaultMachine(array $config)
	{
		// Name of inputs and outputs with properties
		$io_name = isset($config['io_name']) ? (string) $config['io_name'] : 'item';

		// Create default transitions?
		$no_default_transitions = !empty($config['crud_machine_no_default_transitions']);	/// @deprecated

		// Exists state only
		$this->states = array_replace_recursive($no_default_transitions ? array() : array(
			'exists' => array(
				'label' => _('Exists'),
				'description' => '',
			),
		), $this->states ? : []);

		// Simple 'exists' state if not state select is not defined
		if ($this->state_select === null) {
			$this->state_select = '"exists"';
		}

		// Actions
		$this->actions = array_replace_recursive(array(
			'create' => array(
				'label' => _('Create'),
				'description' => _('Create a new item'),
				'transitions' => $no_default_transitions ? array() : array(
					'' => array(
						'targets' => array('exists'),
					),
				),
				'returns' => self::RETURNS_NEW_ID,
				'block' => array(
					'inputs' => array(
						$io_name => array()
					),
					'outputs' => array(
						'ref' => 'return_value'
					),
					'accepted_exceptions' => array(
						'PDOException' => true,
					),
				),
			),
			'edit' => array(
				'label' => _('Edit'),
				'description' => _('Modify item'),
				'transitions' => $no_default_transitions ? array() : array(
					'exists' => array(
						'targets' => array('exists'),
					),
				),
				'block' => array(
					'inputs' => array(
						'ref' => array(),
						$io_name => array()
					),
					'outputs' => array(
						'ref' => 'ref'
					),
					'accepted_exceptions' => array(
						'PDOException' => true,
					),
				),
			),
			'delete' => array(
				'label' => _('Delete'),
				'description' => _('Delete item'),
				'weight' => 80,
				'transitions' => $no_default_transitions ? array() : array(
					'exists' => array(
						'targets' => array(''),
					),
				),
				'block' => array(
					'inputs' => array(
						'ref' => array(),
					),
					'outputs' => array(
					),
					'accepted_exceptions' => array(
						'PDOException' => true,
					),
				),
			),
		), $this->actions ? : []);
	}
protected function setupDefaultMachine ( array $ config ) { // Name of inputs and outputs with properties $ io_name = isset ( $ config [ 'io_name' ] ) ? ( string ) $ config [ 'io_name' ] : 'item' ; // Create default transitions? $ no_default_transitions = ! empty ( $ config [ 'crud_machine_no_default_transitions' ] ) ; /// @deprecated // Exists state only $ this -> states = array_replace_recursive ( $ no_default_transitions ? array ( ) : array ( 'exists' => array ( 'label' => _ ( 'Exists' ) , 'description' => '' , ) , ) , $ this -> states ? : [ ] ) ; // Simple 'exists' state if not state select is not defined if ( $ this -> state_select === null ) { $ this -> state_select = '"exists"' ; } // Actions $ this -> actions = array_replace_recursive ( array ( 'create' => array ( 'label' => _ ( 'Create' ) , 'description' => _ ( 'Create a new item' ) , 'transitions' => $ no_default_transitions ? array ( ) : array ( '' => array ( 'targets' => array ( 'exists' ) , ) , ) , 'returns' => self :: RETURNS_NEW_ID , 'block' => array ( 'inputs' => array ( $ io_name => array ( ) ) , 'outputs' => array ( 'ref' => 'return_value' ) , 'accepted_exceptions' => array ( 'PDOException' => true , ) , ) , ) , 'edit' => array ( 'label' => _ ( 'Edit' ) , 'description' => _ ( 'Modify item' ) , 'transitions' => $ no_default_transitions ? array ( ) : array ( 'exists' => array ( 'targets' => array ( 'exists' ) , ) , ) , 'block' => array ( 'inputs' => array ( 'ref' => array ( ) , $ io_name => array ( ) ) , 'outputs' => array ( 'ref' => 'ref' ) , 'accepted_exceptions' => array ( 'PDOException' => true , ) , ) , ) , 'delete' => array ( 'label' => _ ( 'Delete' ) , 'description' => _ ( 'Delete item' ) , 'weight' => 80 , 'transitions' => $ no_default_transitions ? array ( ) : array ( 'exists' => array ( 'targets' => array ( '' ) , ) , ) , 'block' => array ( 'inputs' => array ( 'ref' => array ( ) , ) , 'outputs' => array ( ) , 'accepted_exceptions' => array ( 'PDOException' => true , ) , ) , ) , ) , $ this -> actions ? : [ ] ) ; }
Setup basic CRUD machine.
Setup basic CRUD machine .