Jump to content


windsor

Member Since 31 Jan 2013
Offline Last Active Mar 26 2019 11:20 PM
*****

Topics I've Started

Which is better pass object or id as parameter to PHP function?

22 March 2014 - 04:06 PM

Hi, 

What are the pro's and con's of passing a object vs the object->id into a function ? 

 

For example this: 

public static function doSomething($myObjectId)
{
   $myObject = MyObject::getById($myObjectId);
   return $myObject->myAttribute;

vs this:

public static function doSomethingElse($myObject)
{
   return $myObject->myAttribute;
}

At first I thought maybe pass id was more efficient, but since PHP passes all parameters by reference, it's only passing a pointer - is that even a correct statement?,

therefore if you want to use the object you need to call Object::getById() - which must incur some performance penalty - right?

 

Does it make a difference if the function is declared static?

 

Does it matter if the function returns a value or calls  a function?

 

Does it make a difference whether the object has nested relations?

 

Under what conditions is it preferable to pass the $id rather than the $object itself?

( I can think of maybe one, when the $id by itself is going to be passed to an api).

 

Anyhow, any PHP experts out there please weigh-in with your knowledge and opinions!

 

 


Easier way to integrate custom modules & extensions

04 March 2014 - 05:30 PM

Currently customManagement approach is quite complicated. Need to simplify the way external code is integrated with Zurmo.

 

it would be great if we had integration with composer and modular style interface for new extensions. I think @Jason mentioned this in dev session today. 

 

 


Bug: PDOTest

27 February 2014 - 11:08 PM

version 2.6.3

PDOTest::testPDOTypesToShowTheDodginessOfNotBeingAbleToGetNumbersOut

//Bad
// if (($phpVersion == '5.3.6' || $phpVersion == '5.3.5' || $phpVersion == '5.5.2') && $mysqlVersion == '5.5') 

//Good
if (($phpVersion == '5.3.6' || $phpVersion == '5.3.5' || $phpVersion == '5.5.2' || $phpVersion == '5.4.7') && $mysqlVersion == '5.5')

Bug: SearchUtilTest lines 590, 609

27 February 2014 - 10:30 PM

Zurmo 2.6.3

SearchUtilTest::testSanitizeDynamicSearchAttributesByDesignerTypeForSavingModelWithSanitizableItemsNestedSingleLevel

//array('firstDate' => '5/4/1011', // Typo bug
array('firstDate' => '5/4/2011',   // Corrected
//array('firstDate' => '1011-05-04', //Typo bug
array('firstDate' => '2011-05-04',   //Corrected

Meeting agendas

18 February 2014 - 07:51 PM

A meeting agenda module would be nice to have

 

it should have 3 models:  each of which should be targets for MashableActivity (meetings, notes, tasks)

 

  • Agenda
    •   (the base class with views for Edit&Detail, Print pdf, etc.)         
  • AgendaTopic   
    • (each item on the agenda)
  • AgendaIssue    
    • (An unknown in the form of a question, raised for an AgendaTopic -possibly convertable to task?) 

 

Agenda should have at least the following 'member' fields:

 

name        (just for consistency ?)

objectives

location

date

time

 

it should have at least the following 'relations'

 

organizer       HAS_ONE   'User'      <--- what if the organizer is a 'Contact' ?

meeting          HAS_ONE

agendaTopic  HAS_MANY  OWNED

 

The agendaTopic model should have at least the following 'member' fields:

 

start  (datetime)

duration

finish (derived from start and duration for display only)

name (topic/description)

number: (string)

owner

resolved  (checkbox)

resolution

dueBy      (if not resolved)

 

The agendaTopic model  should have the following 'relations'

 

agenda    HAS_ONE

issues      HAS_MANY  'AgendaIssue' OWNED

 

The AgendaIssue model should have at least  the following 'members'

 

name:

number:  (string)

description (textArea)

closed

 

The agendaIssue model  should have at least the following 'relations'

 

topic  HAS_ONE

owner HAS_ONE 'User'

 

What do you think?